This series mainly records what the design pattern intends to be, what issues it wants to solve, and when it can be used; how it solves it, master its structure diagram, remember its key code; be able to think of at least two of its application instances, one in life and one in software; What are the advantages and disadvantages of this model, and what use scenarios are there, what should I pay attention to when using it.
Respect the author. For reposted, please indicate the Blog of Xiaoyang.Http://blog.csdn.net/hacke2
11. Facade Mode
Intention: Provides a consistent interface for a group of interfaces in the subsystem. The Facade mode defines a high-level interface, which makes the subsystem easier to use.
Main Solution: Reduces the complexity of accessing the internal subsystem of a complex system and simplifies the interface between the client and the system.
When to use: 1. the client does not need to know the complex contact in the system. The entire system only needs to provide a "receptionist". 2. Define the System Portal.
Solution: The client is not coupled with the system. The portal class is coupled with the system.
Structure chart:
Key code: Add a layer between the client and the complex system. This time, the call sequence, dependency, and so on are processed.
Application Instance: 1. when you go to the hospital to see a doctor, you may need to go to registration, outpatient service, price assignment, and take medicine, which makes the patient or the patient's family feel complicated. If there is a reception staff, only the reception staff can handle the problem, 2. JAVA three-tier development model
Advantages: 1. Reduce system dependencies 2. improve flexibility 3. Improve Security
Disadvantages: It does not conform to the open and closed principle. If it is difficult to change things, it is not appropriate to rewrite inheritance.
Use Cases: 1. provide external access to complicated modules or subsystems 2. The subsystems are relatively independent 3. prevent risks caused by low-level personnel
Notes: In a hierarchical structure, you can use the Facade mode to define the entries for each layer of the system.
PS: You don't need a proper default format. After you get it again, it feels much clearer.