Wednesday, September 2, 2015

Facade Design Pattern - A brief note

What is Facade Design Pattern?


Facade, pronounced as fuh-sahd, originated from french façade and italian facciata, meaning the face of a building, esp the main front or a front or outer appearance.

Lets see what it means in the world of design patterns.There are two important part of the problem it addresses:
a) The subsystems within a system 
b) Interaction between subsystems of two different systems. 

Sometimes the interaction becomes so complex, that we need to create a layer abstraction which can help in achieving simplicity by introducing simple interface to communicate.


Definition

Now lets see the official GoF definition, Facade Pattern: a single class that provides a unified interface to an entire subsystem.

Use case or example of Facade


There are many use case if we look through the interactions between various systems and their components. One such example is the interaction that happens between various components in Supply Chain Domain. The below image explain one such interaction. Although this is not exact interaction but this pretty much explains the crux of Facade.

Prototype

Prototype is another creation pattern. Intent:  - Intent is to create objects by cloning existing instance  - Specify the kinds of obj...