System DesignLLD (Low-Level Design)

Facade Design Pattern

M

Mostakin Mondal

February 21, 2026•4 min read·0% completed

The Facade Pattern helps simplify complex systems. Instead of making clients deal with many different classes and methods, it provides a single, simple interface.

Think of it like a universal remote for your TV and other devices. You don’t need to know how each device works internally , you just press a button on the remote.

The key idea is: hide the complexity and make the system easier to use.

  • Simplifies interactions: Clients use one main interface instead of multiple subsystem classes.

  • Reduces dependencies: Clients don’t need to know the internal details of the system.

  • Promotes cleaner code: Makes your code easier to maintain and understand.

    Facade vs Adapter

  • Facade: Makes a complex system easier to use by providing a simple interface. You don’t see the details behind the scenes.

  • Adapter: Lets two incompatible systems work together by converting one interface into another.

In short: Facade hides complexity, Adapter connects incompatible things.

Example

Think about turning on a laptop. When you press the power button, you are not manually starting the power supply, spinning the hard disk, or loading the operating system. The button takes care of all these steps for you.

This is exactly what a Facade does in software: it gives one simple interface that handles many behind-the-scenes operations, so you don’t have to deal with the complexity yourself.

Example UML Diagram

Principle of Least Knowledge (Law of Demeter)

The Facade Pattern follows the idea of “talking only to your immediate friends.” This means a class should only call methods of:

  • Itself

  • Objects passed as parameters

  • Objects it creates internally

  • Its direct components

Following this principle keeps your system simple and reduces unnecessary connections between classes.

Subsystems in the Computer Example

When you turn on a computer, multiple subsystems work together:

  • Power Supply

  • Cooling System

  • BIOS

  • Hard Drive

  • Operating System

Each subsystem is complex, but the Facade (the power button) makes it easy for the user.

More Examples

  • Home Automation: One button locks doors, switches off lights, and activates security.

  • Game Console: One power button starts the console, screen, and audio.

  • Media Player: One button loads the movie, subtitles, and audio settings.

The Facade hides complexity and gives a simple interface to the user.

Use of the Facade Pattern

  • Simplifying Complex Systems: Hides the complexity of databases or APIs so clients don’t need to deal with them directly.

  • Layering Subsystems: Creates clear boundaries and simpler interfaces for each part of the system.

  • Unified Interface for Multiple Systems: Combines different APIs or older systems into one easy-to-use interface.

  • Protecting Clients from Changes: Keeps a stable interface even if internal systems change.

Advantages

  • Simple Interface: Clients only see what they need, not all the details.

  • Reduced Coupling: Clients are less dependent on internal subsystems.

  • Encapsulation: Changes inside subsystems don’t affect clients.

  • Easier Maintenance: Updating or refactoring the system is simpler without breaking client code.

Disadvantages

  • Extra Layer: Adds another layer of code, which can make things a bit more complex to understand.

  • Limited Flexibility: Direct access to some subsystem features may be restricted.

  • Overengineering Risk: Using it for very simple systems can be unnecessary.

  • Performance Impact: Extra abstraction may slightly affect speed in performance-critical situations.

Steps to Implement the Facade Pattern

  1. Identify Subsystems: Figure out the complex parts of the system that the client needs to work with.

  2. Create a Facade Class: Make a class that sits between the client and the subsystems. It will simplify interactions.

  3. Define a Simple Interface: The facade class should provide easy-to-use methods that the client will call. Hide the details of the subsystems.

  4. Delegate Tasks: Inside each facade method, call the right subsystem classes to do the actual work.

  5. Client Uses Facade: The client interacts only with the facade, which handles all the internal calls, making the system easier to use.

This approach keeps your code organized and shields clients from the complexity of multiple subsystems.

UML Diagram

Summary

The Facade Pattern simplifies complex systems by providing a single, easy-to-use interface for clients. Instead of dealing with many classes and methods, the client interacts with the Facade, which handles all the internal operations behind the scenes. It reduces dependencies, keeps code cleaner, and makes maintenance easier. Examples include a laptop power button that starts multiple subsystems or a home automation button that controls lights, locks, and security at once. Essentially, the Facade hides complexity while letting users interact with the system in a simple, straightforward way.

Code

By Coder Army

Related Articles