Façade Design PatternFaçade is a structural design pattern which provides the simpler interface to a library or complex set of classes. The word Façade is simply referred to an outer lying interface of complex patterns that contains several sub-systems. It is a very important part defined by the Gangs of Four design patterns. In the simple word, it defines the higher level interface that any subsystem can use. The main façade class keeps track which subsystem is responsible for a request. This design pattern helps in communicating with the subsystem easily to the client. ![]() Problem without Façade Design PatternSuppose we have written the code to work with a large set of the objects which belong to the sophisticated framework or library. So here we need to take care about the all dependencies, initialize all of those objects, execute methods in the correct order, and so on. For example - Imagine you call a pizza shop to place an order. The executive takes and your pizza will be prepared by the chef. Then, it will deliver to you. So there are several subtasks related with each other. We need to create a system that automates the whole task without the disturbance of us. Solution using Façade MethodTo solve the problem, we require a façade method. It will help us to hide the complexity of the subsystem. Here an operator (executive) is your façade to all services and departments of the shop. Your voice works as the interface to the ordering system, payments, and gateways and delivery service. Let's understand the following example. Example - Advantages of Façade MethodThere are several advantages of using façade method; we describe few important advantages as follows.
Disadvantages of Façade MethodBelow are the few disadvantages of façade method.
ApplicabilityLet's understand the applicability of the façade method.
Next TopicObject-Oriented Pattern
|