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.