Facade Design Pattern comes under Structural Design Pattern. In short, Facade means the exterior appearance. It means in Facade design pattern we hide something and show only what actually client requires.
A well-designed system is easy to manage, maintain and develop. So right design pattern is a must follow guidelines to develop an optimized software application.
Here we will try to understand Facade Design Pattern in details.
What is Facade Design Pattern?
Facade design Pattern is used to make a complex system easier.
So basically when and how to implement Facade Design Pattern?
Facade Design Pattern should be implemented -
When a system is more complex with a large number of classes.
In Facade Design Pattern client does not need to know all classes or subsystems to work. A client only requires a Facade class which will automatically call connected subsystems and classes internally.
For eg- If you buy a product from an e-commerce website, you just log in to the system, select your product and place the order. You even don't know whats going on behind the screen.
There could be various logic running behind the screen.
1. Checking inventory
2. Checking nearest warehouse location.
3. Checking any offer/discount for the customer.
4. Payment system
and much more.
Below picture explains about Facade Design Pattern.
You can see in above example that Client 1,2,3,....n will only connect Order Management class which implements Facade Design Pattern. And then Order Management class will call subsystem1 and susbsytem2 based on business logic implemented in the system.
Prev Blog - Thread Safety Singleton
You may read some popular blogs on SharePointCafe.Net