Related Articles

Back to Latest Articles

A Complete Guide To Design Patterns: Façade Design Pattern

The Façade design pattern is a structural design pattern. It reduces coupling and improves code readability.

Baraa Abuzaid
A Complete Guide To Design Patterns: Façade...


The Façade design pattern is a structural design pattern. It reduces coupling and improves code readability. you are very likely to use the Façade pattern when you would like to simplify the interaction between subsystems and a client-class. It is considerably useful in places where you don’t want to manage the complexity of subsystems in a client-class or even just to hide the complexity of a subsystem.

Generally, here are the steps to effectively implements a Façade pattern:

1- Design an interface that defines the main action of the subsystem.
2- Subsystems should then implements the interface.
3- Create a Façade class the wraps the classes that implement the interface
4- Use the faced class to access the subsystem.


Let’s discuss a scenario in which we are creating a feature’s rich note taking App where the user could create notes, reminders, and memos. We cloud identify three subsystems Note-class and a Reminder-class and Memo-class. Moreover, these three classes could adhere to IPost Interface. That has the following sets of actions create() , update() , delete() and read().
Then we could wrap the IPost interface with Facade class that’ll micromanage the interaction between the Client class and Subsystem class.

It’ll become a lot more clear when depicting the relations in Façade pattern with a UML class diagram.




public interface IPost {

    void create();
    void update(String content);
    void delete();
    void read();

public class EditorService {
    HashMap<String,IPost> posts;

    public EditorService(HashMap<String, IPost> posts) {
        this.posts = posts;

    public int createNewPost(String type){
        if (type.equals("memo")){
            posts.put(UUID.randomUUID().toString(),new Memo());
            return 0;
        } else if(type.equals("note")){
            posts.put(UUID.randomUUID().toString(),new Note());
            return 0;
        }else if(type.equals("reminder")){
            posts.put(UUID.randomUUID().toString(),new Reminder());
            return 0;

        return -1;

    public void edit(String id,String content){
        IPost post = posts.get(id);



Feature photo by Ricardo Gomez Angel


Show Comments (0)


Related Articles

Object Oriented Design

Understanding UML Class Diagram “The Fastest Approach…”

Understanding UML Diagram might be quite daunting task especially for those of Us whose not coming from formal CS background, you see all of these square boxes and different type...

Posted on by Baraa Abuzaid
Object Oriented Design

A Complete Guide To Design Patterns: The Adapter Design Pattern

The adapter design pattern is a structural design pattern. As the name drove from the adapter in the physical world, the adapter design pattern work in a similar way. In many...

Posted on by Baraa Abuzaid