Facade
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use. This can be used to simplify a number of complicated object interactions into a single interface. A facade can:
- make a software library easier to use and understand, since the facade has convenient methods for common tasks.
- make code that uses the library more readable, for the same reason.
- reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system.
- wrap a poorly-designed collection of APIs with a single well-designed API (as per task needs).
An Adapter is used when the wrapper must respect a particular interface and must support a polymorphic behavior. On the other hand, a facade is used when one wants an easier or simpler interface to work with.
Facade-The facade class interacts Packages 1, 2, and 3 with the rest of the application.
Clients-The objects using the Facade Pattern to access resources from the Packages.
Packages -Software library / API collection accessed through the Facade Class.
Facade is a design pattern that hides the details and complexities of the lower-level software services for which it is written, making the service easier to use. In fact, the lower-level classes need not be classes at all; they can be an API in the form of a code library or a Web service.
A Facade also provides a unified entry point into the layers of the software. This reduces the application's dependency on the software service details and allows the Facade to hide future changes in the software service itself.
