liveBook · Manning

Facade pattern

As explained in Object-Oriented Software Design in C++

The Façade Design Pattern is a structural design pattern that provides a unified, simplified interface to a set of subsystem interfaces.

The Façade pattern provides a unified, simplified interface to a complex subsystem of multiple interfaces. It makes code easier to use without modifying the subsystem classes. section 10.0 section 10.2

Apply the pattern by placing subsystem coordination behind a façade:

  • Identify the repeated sequence of operations required by clients. section 10.2
  • Create a façade class with a simpler operation that coordinates the subsystem classes. section 10.2.3
  • Change clients so they depend on the façade instead of directly depending on every subsystem interface. section 10.2.3
  • Keep subsystem details centralized, reducing duplication and limiting the impact of future subsystem changes. section 10.2.3

Fundraising façade

A college athletics department must solicit alumni, schedule booster-club meetings, and collect student fees. FundRaiser exposes do_fund_raising(), which performs those three calls. AthleticsDept and Administration each call only that façade operation, rather than constructing and coordinating Alumni, BoosterClubs, and Students themselves. section 10.2 section 10.2.3

Figure 10.7 The architecture modeled from the Façade Design Pattern hides the details of fundraising behind the façade class FundRaiser, which presents a higher-level interface that simplifies using the subsystem consisting of classes Alumni, BoosterClubs, and Students.

Use the architecture diagram to trace how FundRaiser hides Alumni, BoosterClubs, and Students from AthleticsDept and Administration. section 10.2.3

How Object-Oriented Software Design in C++ covers it

How deep it goes
Explains the pattern through a concrete workflow, façade class, client dependencies, and generic architecture without deeper implementation internals.
Examples
Uses car-starting steps, college fundraising, FundRaiser, AthleticsDept, Administration, Alumni, BoosterClubs, and Students.
What it assumes
Assumes familiarity with classes and interfaces while teaching the subsystem problem and façade roles from a concrete example.
What you can do after
Build it from scratch by wrapping repeated subsystem workflows in a façade and redirecting clients through its simpler interface.
How it connects
Connects façade design with code duplication, loose coupling, Principle of Least Knowledge, and Encapsulate What Varies.

Also explained in

Compare how 3 books explain facade pattern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Object-Oriented Software Design in C++. The section links point to the parts of the book it draws on.