Facade Pattern classified into Structural Pattern is unified interface that represents entire by hiding the complexities.
It provides the higher level interface which makes subsystem easier to use. It provides client with a single entry point which eliminates knowing the complexity of many subsystems beneath it.
In this pattern, facade object is aware of the responsibility owned by subsystem classes. It essentially delegates the client request to subsystem classes; whereas sub-system classes perform operation as assigned by facade object and doesn’t holds any reference to it.
Below is the sample class diagram demonstrates Facade pattern where client makes a call to Facade class and the subsystem operations are managed by facade thereby eliminating the client to directly deal with subsystems.
Code for Facade Class:
public class Facade
private IValidateUser _validateuser;
private IAddUser _adduser;
private INotifyService _notifyservice;
_validateuser = new ValidateUser();
_adduser = new AddUser();
_notifyservice = new NotifyService();
public bool AddUser(User user)
< Back to Design Patterns