What is Facade Pattern?

What is Facade Pattern?

Do you work as a freelancer? And important question is, do you work from home?

If you answer is in YES then you are facing real problems, problems that are bigger than impressing your girlfriend or bigger than convincing your parents about your girlfriend.

The problem is to listen ever order of your mother, She will ask you to bring DAHI(yogurt) from the market. And when you came back home She will ask you to get some vegetables for lunch and after that, you will be ordered to bring some fresh water to drink.

And you are like, Mom, why don’t you give me the list of all the stuff I have to do repeatedly? WHY?

That’s where Facade Design pattern came into play.

Same as a programmer, In you code life cycle you have to do repeated steps in some sequence. And you have to call each function of the respective class to do their job every time.

Let suppose, you have two classes.


public class Vegetables{
public List GetVegs(){
    var vegs= new List();
    return vegs;


public class Groceries{
public List GetGross(){
    var gross= new List();
    return gross;

Main class

static void Main(string[] args){
    var veg= new Vegetables();
    var gros = new Groceries();
    // To Get vegetables

    // To Get other groceries items

Facade Impelemtation

Now in this, I will write a class with method GetItemsFromMarket() and it will take care of getting vegetables and Groceries from the market as well. I don’t have to call them separately.
This pattern will work if you have to go through some series of predefined steps like from market you have to get Vegetables and other items as well. so rather then you go to the market and get the vegetables and come back home and then go again and get other items.

For this kind of scenario, Facade implementation will take care to get vegetables and groceries internally.

class MarketFacade{
    var vegetables= new Vegetables();
    var vegetables= new Groceries();
   public string GetShoppingItems(){
   return "Shopping Done !";

Facade design pattern will satisfy and make your life easier to do things that you need repeatedly.

With the above implementation, you just have to call one method of MarketFacade class and that method will do all the necessary function that you wanted without you to initialize other class members and calling their function again and again.

Yippee ! Hope you will like the way I explained here.

But if are saying impossible that you didn’t like much. then surely you will have to give the comments below, and I will blow them off :p just kidding. I will surely look into that and come up with a different way that you will love most.

That’s my part till now, see you on the other side of the story, that may be a A Post to remember

If you like this post, comment with tag A Post to remember and I will send you some cheeky kiss :*

Bet ! Happy coding.