Facade is a structural design pattern that provides a simplified interface to a library, a framework or any other complex set of classes. Facade allows you to work with all the classes in a subsystem without worrying about initializing, keeping track of dependencies or executing methods in the correct order. It is also used to prevent your business logic from being tightly coupled to the implementation details of 3rd party libraries or frameworks.
Is Facade a structural design pattern?
The word “facade” comes from the Latin facia, via French, and means face or front of a building. It has also taken on a more figurative meaning, referring to something that covers up or hides a less-than-ideal reality.
In architecture, facades are often used to add architectural interest or to enhance energy efficiency. They can be constructed in a variety of materials css facades, including glass and steel. They can be load-bearing or non-load-bearing, depending on the overall intent of the project.
The Facade pattern works similarly to the Adapter pattern, but on a larger scale. Adapter makes an existing class usable by wrapping it, while Facade changes the interface of an entire subsystem. The latter approach is more useful when you have a lot of different classes that the client needs to interact with. A real-world example of this would be a restaurant system. The customer’s only concern is to look at the menu and order food, but that doesn’t mean they want to know everything that happens inside the kitchen.