What It Is
The Facade pattern puts one simple door in front of a complicated subsystem. Behind the door, several parts cooperate in the right order; in front of it, the caller makes one call.
The subsystem stays fully available for those who need the details — the facade is a convenience, not a wall.
Example: One Call Starts the Day
Heater, lights, coffee machine — three parts, each with its own API and its right order. start_day() hides the choreography behind one call.
One simple door
The caller writes one line; the facade knows the order (heat first, coffee last). If the routine changes, only the facade changes.
Output: complete Python program
class Heater:
def on(self):
print("heater: warming to 21 degrees")
class Lights:
def on(self):
print("lights: on at 40%")
class CoffeeMachine:
def brew(self):
print("coffee: brewing espresso")
# The facade: one simple door to the whole subsystem.
class House:
def __init__(self):
self.heater = Heater()
self.lights = Lights()
self.coffee = CoffeeMachine()
def start_day(self):
self.heater.on()
self.lights.on()
self.coffee.brew()
House().start_day()
When to Use It
Use it when callers keep repeating the same multi-step dance with a subsystem, or when you want to expose a small, stable surface over a messy or changing one.
Skip it when the "subsystem" is one class with three methods. A facade over something already simple only adds distance.
Pros and Cons
Pros: callers get one simple call; the right order lives in exactly one place; the subsystem can change behind a stable front.
Cons: facades tend to grow into do-everything classes; a facade that hides too much pushes people to bypass it.