Review Questions
Observations
Define Facade.
What is the intent of the Facade pattern?
What are the consequences of the Facade pattern? Give an example.
In the Facade pattern, how do clients work with subsystems?
Does the Facade pattern usually give you access to the entire system?
Interpretations
-
The Gang of Four says that the intent of the Facade pattern is to "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."
-
What does this mean?
-
Give an example.
-
Here is an example of a Facade that comes from outside of software: Pumps at gasoline stations in the United States can be very complex. There are many options on them: how to pay, the type of gas to use, watch an advertisement. One way to get a unified interface to the gas pump is to use a human gas attendant. Some states even require this.
-
What is another example from real life that illustrates a Facade?
Opinions and Applications
If you need to add functionality beyond what the system provides, can you still use the Facade pattern?
What is a reason for encapsulating an entire system using the Facade pattern?
Is there a case for writing a new system rather than encapsulating the old system with Facade? What is it?
Why do you think the Gang of Four call this pattern Facade? Is it an appropriate name for what it is doing? Why or why not?
Footnote
1. Gamma, E., Helm, R., Johnson, R., Vlissides, J., Design Patterns: Elements of Reusable Object-Oriented Software, Boston: Addison-Wesley, 1995, p. 185.