Design Mode Training 9: appearance Mode

Source: Internet
Author: User

1. Definition: 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.

Ii. Intention:

1. Provide a simple interface for a complex Subsystem

2. Reduce coupling between clients and subsystems

The appearance (facade) mode is the simplest mode. We unconsciously use the appearance mode during development. For example, in the three-layer structure, dataaccesslayer, businesslayer, and interfacelayer, generally, businesslayer combines the logic of dataaccesslayer. However, to display the expected results on the interfacelayer layer, you also need to combine and process interfaces in various businesslayer to achieve the desired display effect, because we add a facade layer between businesslayer and interfacelayer, which combines the interfaces of the logic layer to form a unified interface for interfacelayer to call, this reduces the coupling between the interfacelayer and businesslayer.


Because it is too simple,CodeThe facade mode is relatively simple, but it is a reflection of an important programming idea, that is, the low coupling and high cohesion of object-oriented. during the development process, we should try our best to make the external call subsystem easier and better.

That is to say, the complex logic is encapsulated in the subsystem to form a unified and simple interface to the external. Do not let the external system call, but also need to understand the internal implementation of the call system.

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: 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.