Selected Reading

Facade Design Pattern in C++



Facade Design Pattern is a structural design pattern that provides a single and simplified interface to a complex system of classes, library or framework. It orginizes a complicated system by adding a simple interface to it.

Instead of having multiple objects to interact with, the client can interact with a single facade object which internally manages the interactions with the complex system.

Imagine the following big "Facade" building is like a magic "Play" button for a whole toy factory. You just press that one button, and inside, all the machines start working together automatically to make toys, without you needing to know how each one works.

Facade Design Pattern Example

Components of Facade Design Pattern

The Facade Design Pattern consists of the following three parts −

  • Facade − This is the main part the user talks to. It provides simplified interface to bunch of subsystems. It act as a middleman between client and complex system.
  • Complex System − Many classes that do the real work. These classes or we also call them subsystems are the ones who actually do the tasks. They can be hard to use directly without the facade.
  • Client − The user. Talks only to the facade, not the complex system. Means, the client doesn't need to know about the complex system, it just uses the facade to get things done.
Components of Facade Pattern