* Provides a Single interface to a group of interfaces in a subsystem.
A simple interface is needed to provide access to a complex system.
You need to reduce coupling between system implementations and clients.
You need to layer subsystems.*/
/*output : FirstClass there are 5 classes FirstClass,SecondClass,ThirdClass,Facade,FacadeClient class in this
Inside FacadeClient Class facade class calls its method operationA()
and also Facade class contains a reference of all
which in turn calls method of classA
ie here we are hiding complexities by
providing nesting callingwe just have to call operationA()
which internally calls classA method printFirstClass
Hopefully the following metaphores will clarify the facade pattern :
* Facade as the name suggests means the face of the building. The people walking past the road can only see this glass face of the building.
They do not know anything about it, the wiring, the pipes and other complexities.
The face hides all the complexities of the building and displays a friendly face.
* Consumers encounter a facade when ordering from a catalog. The consumer calls one number and speaks with a customer service representative.
The customer service representative acts as a facade, providing an interface to the order fulfillment department, the billing department, and the shipping department.