Facade

Intent

  • Provide an unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.

Problem

  • How can a simple interface be provided for a complex subsystem?

  • How can tight coupling between clients and the objects in a subsystem be avoided?

Solution

  • Define a separate Facade object that provides an unified interface for a set of interfaces in a subsystem.

  • Work through a façade to minimize dependencies on a subsystem.

Advantages

✅ Decouples clients from a subsystem. ✅ Decouples subsystems.

When to use

  • A simple interface is required to access a complex system.

  • A system is very complex or difficult to understand.

  • When an entry point is needed to each level of layered software.

  • When the abstractions and implementations of a subsystem are tightly coupled.

Notes

  • Logging functionality is a good example of façade design pattern. Example being, Logback in java.

Last updated