What is the Facade pattern? How does it differ from Adapter, and what happens when it's overused?
Short answer
A Facade is one simple entry point to a whole subsystem: the caller calls one method and the facade calls the classes underneath in the right order. Unlike an Adapter, which converts the interface of an existing thing, a Facade creates a new, smaller interface over many things.
3 points to say:
- A facade hides the complexity of many classes behind one method; the caller doesn't need to know the call order.
- An Adapter makes things compatible (one interface to another); a Facade makes things simple (many classes, one door).
- Overused, it becomes a god facade: business rules pile in, it bloats and is hard to test; a facade should only orchestrate.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.