Structural PatternsFacade PatternEasy⏱️ ~2 min

Facade Pattern - Definition and Core Problem

Definition
Facade Pattern provides a simplified, unified interface to a complex subsystem of classes, making the subsystem easier to use without hiding its functionality entirely.
What Problem Does It Solve?
When systems grow, clients often need to interact with many interconnected classes. This creates tight coupling and makes client code complex. The Facade Pattern addresses three core issues:
First, it reduces coupling between clients and subsystem components by introducing a single entry point.
Second, it hides complex initialization sequences and interdependencies from clients who just want simple operations.
Third, it provides a cleaner API (Application Programming Interface) for common use cases while still allowing direct subsystem access when needed.
Key Distinction
Unlike Adapter Pattern (which converts one interface to another), Facade provides a new, simpler interface to existing interfaces. Unlike Mediator Pattern (which centralizes communication between components), Facade only simplifies client access without changing how subsystem components interact with each other.
Interview Tip: Emphasize that Facade does not restrict access to subsystem classes. Clients can still use subsystem classes directly if they need fine-grained control, but most clients prefer the simpler facade interface.
💡 Key Takeaways
Provides a unified interface to a set of interfaces in a subsystem
Reduces complexity for clients by hiding intricate initialization and interaction logic
Does not prevent direct access to subsystem classes when needed
Creates loose coupling between clients and subsystem implementations
📌 Examples
1Home theater system: single <code>watchMovie()</code> method instead of manually controlling projector, amplifier, DVD player, and lights
2Hotel booking: <code>bookRoom()</code> facade hiding payment, inventory, notification, and logging subsystems
← Back to Facade Pattern Overview
Facade Pattern - Definition and Core Problem | Facade Pattern - System Overflow