-
Notifications
You must be signed in to change notification settings - Fork 34
04. Facade design patterns
The Facade pattern provides an interface which shields clients from complex functionality in one or more subsystems. It is a simple pattern that may seem trivial but it is powerful and extremely useful. It is often present in systems that are built around a multi-layer architecture.
The intent of the Façade is to provide a high-level interface (properties and methods) that makes a subsystem or toolkit easy to use for the client.
On the server, in a multi-layer web application, you frequently have a presentation layer which is a client to a service layer. Communication between these two layers takes place via a well-defined API. This API, or façade, hides the complexities of the business objects and their interactions from the presentation layer.
Another area where Façades are used is in refactoring. Suppose you have a confusing or messy set of legacy objects that the client should not be concerned about. You can hide this code behind a Façade. The Façade exposes only what is necessary and presents a cleaner and easy-to-use interface.
Facades are frequently combined with other design patterns. Facades themselves are often implemented as singleton factories.
├───.github
│ └───workflows - handle CD
├───bin - execute run projet
├───business
│ ├───components
│ │ ├───account
│ │ ├───auth
│ │ ├───data-config
│ │ ├───invitation
│ │ └───invocation
│ ├───entities
│ │ └───mongodb
│ └───facade
├───configs
├───controllers
│ ├───bank
│ ├───invitation
│ ├───invocation
│ └───manager
│ ├───account
│ ├───invitation
│ └───invocation
├───core
├───domains
│ └───mongodb
├───helpers
├───middlewares
├───public
│ ├───assets
│ │ ├───css
│ │ ├───fonts
│ │ │ └───wedding
│ │ ├───images
│ │ │ └───flags
│ │ └───js
│ │ ├───base
│ │ └───live
│ │ ├───account
│ │ ├───invitation
│ │ └───invocation
│ └───plugins
│ ├───clipboard
│ ├───datatables
│ ├───magnific-popup
│ └───toastr
└───views
├───err
├───invitation
├───invocation
├───manager
│ ├───account
│ ├───invitation
│ └───invocation
└───share