FACADE
FACADE
FACADE
Object Diagram for
Facade using Phone
Order Example
Intent
Provide a unified interface to a set of interfaces in a
subsystem. Facade defines a higher-level interface
that makes the subsystem easier to use.
Problem:
A segment of the client community needs a simplified
interface to the overall functionality of a complex subsystem
Structural Facade
Illustration: Problem
Consider for example a programming envirnoment that gives
application access to its compiler subsystem. This
subsystem contains classes such as Scanner,
Parser,ProgramNode, ByteCodeStream, and
ProgramNodeBuilder that implements te Compiler. Some
Specialized applications might need to access these classes
directly.
But most clients of a compiler generally don’t care about
details like parsing and byte code generation; they merely
want to complier subsysem only complicate their task.
Structural Facade
Illustration : solution
Facade
Illustration: solution
Structural Facade
Applicability
Use the Façade pattern when
• You want to provide a simple interface to a complex subsystem.
– To tackle the complexity of subsystem as they evolve
– Most patterns, when applied, result in more and smaller classes.
This makes the subsystem more reusable and easier to
customize, but it also becomes harder to use for clients that
don’t need to customize it.
– A façade can provide a simple default view of the subsystem
that is good enough for most client. Only clients needing more
customizability will need to look beyond the façade
Structural Facade
Applicability……...
Use the Façade pattern when
Facade
Subsystem classes
Structural Facade
Collaborations
Consequences