Facade
Put one simple class in front of several subsystems so common jobs take one call, while the parts stay reachable.
The problem it solves
Placing an order touches four subsystems: inventory, payments, shipping and notifications. Each has its own small API. Without help, every caller (web handler, mobile API, admin tool) must:
- Know the right order of calls.
- Remember the undo step if payment fails after stock was reserved.
- Import four classes.
Callers drift. One forgets the undo and leaks stock.
A facade is a single class that offers a simple method for the common job and hides the subsystem choreography behind it. The word comes from architecture: the front of a building.
1 of 7