Design patterns implementation examples

Facade

Definition:

Gives a client unified and easy to use high level interface to a set of interfaces in a subsystem.


Example:

For instance a TV has knobs which make controlling it easier. We do not give users a possibility to control it by turning up the knob with a screwdriver inside a TV. Firstly it is unhandy/too complicated/dangerous and secondly user may derange/break a device.


C++ code:

/src/facade.cpp
Download source code

Facade UML class diagram:
Facade UML class diagram

Facade UML sequence diagram:
Facade UML sequence diagram