Facade Pattern

It hides the complexities of the system and provides an interface to the client from where the client can access the system.

The direct interaction of clients with subsystem classes leads to a high degree of coupling between the client objects and the subsystem. Whenever a subsystem class undergoes a change, such as a change in its interface, all of its dependent client classes may get affected. The Façade pattern is useful in such situations and provides a higher level, simplified (usually new) interface for a subsystem resulting in reduced complexity and dependency. This in turn makes the subsystem usage easier and more manageable.

Clients communicate with the subsystem by sending requests to Facade, which forwards them to the appropriate subsystem object(s). Although the subsystem objects perform the actual work, the facade may have to do work of its own to translate its interface to subsystem interfaces.


Client interaction when we do not have a Facade


Client interaction with Facade


  • Reduces compilation dependencies when subsystem classes change
  • It doesn't prevent applications from using subsystem classes directly
  • Facade objects are often Singletons

Related Patterns:

  • See Facade pattern usage in J2EE applications.
  • Abstract Factory can be used with Facade to provide an interface for creating subsystem objects in a subsystem-independent way. Abstract Factory can also replace facade.
  • Mediator is similar to Facade in that it abstracts functionality of existing classes. However, Mediator's purpose is to abstract arbitrary communication between colleague objects, often centralizing functionality that doesn't belong in any one of them. A mediator's colleagues are aware of and communicate with the mediator instead of communicating with each other directly. In contrast, a facade merely abstracts the interface to subsystem objects to make them easier to use; it doesn't define new functionality, and subsystem classes don't know about it.
  • Facade might look similar to Adapter Pattern but Facade creates a new interface and adapter uses two old interfaces work together.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License