Facade Pattern is a Structural Design Pattern that insulates a set of sub systems and their interfaces to the Client by providing common, unified interface.
Intention
- Hides the complexity of sub systems.
- Reduces the network round trip calls.
- Decouples the sub system functions and interfaces from the Client.
Sub Systems - A set of complex modules that collaborate to perform a functionality.
Facade - Unified interface that Client is provided hiding the complex interaction among Sub Systems.
Client - The User who invokes the Facade to get the function done.
In above example, Client only calls to the UserLoginFacade to login. UserLoginFacade uses Authentication module to validate the user and Authorization module to assign roles if the user is a valid one and log the actions by calling LogUser module.
In the end, Client only gets a boolean value stating that the user is allowed login or not.
No comments:
Post a Comment