The appearance mode provides a consistent interface for a group of interfaces in the subsystem. The Facade mode defines a high-level interface, which makes this subsystem easier to use.
There are many examples of the appearance of security system applications on the Internet. Here I will give an example of a customer service center. Customer Complaints are generally handled through the following series of operations: register the complaint information, assign the Department to be accepted, and submit the complaint information.
If there is no customer service MM, the customer needs to perform registration information, allocate a department, and submit a complaint. I believe you will go crazy soon.
With a customer service MM, the user directly deals with the customer service, and the customer service MM completes subsequent operations for us.
In the above example, the role of the Service MM is the Facade defined in the appearance mode (also known as "Facade "). For a series of complex operations (that is, sub-applications in the Program), users do not care about the details of these operations. In this case, we need to provide an entrance for unified access to these complex operations. All operations on each sub-application are completed through this portal. for users, you only need to care about the functions provided by this portal.
The appearance mode mainly focuses on two aspects: first, All accesses to sub-applications must be completed through a unified portal, and second, this portal is only used to access complex operations in sub-applications, other business logic cannot be added.
The above example of customer service MM is implemented using the appearance mode. The Code is as follows:
[Java]
Class OperationRegist {
Void regist (){
// Handle complaint registration
}
}
Class OperationDispatch {
Void dispatch (){
// Handle complaint allocation
}
}
Class OperationSubmit {
Void submit (){
// Submit Complaint Handling
}
}
Class OperationFacade {
OperationRegist op1 = new OperationRegist ();
OperationDispatch op2 = new OperationDispatch ();
OperationSubmit op3 = new OperationSubmit ();
Void operate (){
Op1.regist ();
Op2.dispatch ();
Op3.submit ();
}
}
By fancy888