Facade Design Pattern

The Facade Design Pattern provides a simple unified interface of a complex system to a client to abstract the complexity and make it easier for client to use. Facade defines a single high level interface that makes the subsystem easier to use. Facade pattern comes under structural pattern as it provides one of the best ways to hide internal complexities from client.

facade is a composition of subsystems and uses delegates the tasks to subsystems. It may also add some logic of it’s own before delegating work to subsystem. However, it doesn’t hide the subsystem interfaces form the client. A client is free to directly interact with subsystem, it is on client whether to use facade or not.

Advantages of Facade Pattern

  • A facade hides the complexity of subsystem and provides a simple interface to client.
  • It decouples the client implementation from the subsystems. We can any of the subsystem without modifying client’s code provides client is only interacting through facade.

When we should use Facade Pattern

  • When we want to provide single unified interface to client to interact with a complex subsystem.
  • When we want to hide the internal complexities of system.
  • When we want to decouple the client’s implementation form subsystems.

Implementation of Facade Design Pattern

Facade_Pattern (1)

First of all we will define the subsystems of a order fulfillment systems.


This class reserves the item for this order.

Facade Design Pattern

public class ReserveInventory {
    public void reserveInventory(){
        System.out.println("Blocking Item for Customer.");

This class deducts the order amount form customers credit card.

public class ReservePayment {
   public void receivePayment(){
      System.out.println("Deducting amount from customer's credit card.");

Facade Design Pattern 1

This class manages the delivery of an item to customers address.

public class DeliverySystem {
   public void deliverOrder(){
      System.out.println("Deliverying Item to customer's address.");

This class cancels customers order.

public class CancelOrder {
    public void cancelOrder(){
        System.out.println("Cancelling order.");


This class refunds the order amount to customer on order cancellation.

Facade Design Pattern 2

public class RefundPayment {
   public void refundOrderAmount(){
      System.out.println("Refunding Order Amount to Customer.");

Now, to place an order we have to first reserve inventory and the reserve payment(deduct customers credit’s card) and finally deliver the item to customer. To hide the complexity of placing order from a third party client we will provide a simple method “placeOrder” in OrderManagementFacade which will handle every thing required for placing an order. Similarly, we will provide “cancelOrder” method in facade for cancelling an order. Order Management Facade hides the complexities of fulfillment subsystems form client.

Facade Design Pattern 3

package FacadePattern;
public class OrderManagementFacade {
    private ReserveInventory reserveInventory;
    private ReservePayment reservePayment;
    private RefundPayment refundPayment;
    private DeliverySystem deliverySystem;
    private CancelOrder cancelOrder;
    public OrderManagementFacade(){
        reserveInventory = new ReserveInventory();
        reservePayment = new ReservePayment();
        refundPayment = new RefundPayment();
        deliverySystem = new DeliverySystem();
        cancelOrder = new CancelOrder();
    public void placeOrder(){
    public void cancelOrder(){

We will define a client class FacadePatternExample.java which will place and cancel the order using Order Management Facade.

Facade Design Pattern 4

public class FacadePatternExample {
    public static void main(String args[]){
        OrderManagementFacade orderingSystem = new OrderManagementFacade();
        // Place Order 
        // Cancel Order 


Blocking Item for Customer.
Deducting amount from customer's credit card.
Deliverying Item to customer's address.
Cancelling order.
Refunding Order Amount to Customer.