Facade#

The Facade design pattern is a structural pattern that provides a simplified interface to a complex subsystem. It hides the complexities of the system and provides an easy-to-use interface for the client.

Imagine you have a complex system with many classes and subsystems. The Facade pattern allows you to create a simple interface that clients can use to interact with the system without having to know the details of how it works.

Key Concepts#

  1. Facade: The simplified interface that clients use to interact with the subsystem.

  2. Subsystem: The complex system that the Facade simplifies.

UML Diagram#

+---------+        +-----------------+
|  Client | -----> |     Facade      |
+---------+        +-----------------+
                        /   |   \
                       /    |    \
                      /     |     \
                     /      |      \
                    /       |       \
                   /        |        \
    +---------------+ +-----------+ +-----------------+
    |  Subsystem1   | |Subsystem2 | |  Subsystem3     |
    +---------------+ +-----------+ +-----------------+
--- Java Example ---
--- Python Example ---