Facade Pattern

Characteristics of Facade

Examples of Facade

Java Implementaion

Phone.class

public interface Phone {

    String build();
}

IPhone.class

public class IPhone implements Phone {

    @Override
    public java.lang.String build() {
        return "IOS 10";
    }
}

FacadeExample.class

public class FacadeExample {

    public static void main(String[] args) {

        // Cleaner Client Code
        PhoneFacade phoneFacade = new PhoneFacade();

        // We are creating phone using facade without going through complex logic
        System.out.println(phoneFacade.buildAndroidPhone());
        System.out.println(phoneFacade.buildApplePhone());
    }
}

Disadvantages of Facade

To access the full working code sample, click here

References

Facade Design Pattern | Implementation and Disadvantages | Clean Code Series
Examples of gof design patterns in javas core libraries

SUBSCRIBE TO NEW CONTENT

Tutorials on System Design, BlockChain, Design Patterns and more sent out once a week.

Loading comments...