Design Mode learning Summary (11) facade Mode

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.