1. Create Mode
The social division of labor is getting finer and finer. Naturally, this is also true for software design. Therefore, the separation of object creation and use has become an inevitable trend. Because object creation consumes a lot of system resources,
Therefore, the creation of objects is researched separately, so that objects can be efficiently created is the issue to be explored in the creation mode. There are 6 specific creation modes available for research:
Simple factory, factory method, abstract factory, builder ),
Prototype And Singleton)
2. Structural Mode
After the problem of object creation is solved, the composition of the object and the dependency between objects become the focus of developers, because how to design the structure, inheritance, and dependency of the object will affect the subsequent
Program maintainability, code robustness, coupling, and so on. The design of the object structure can easily reflect the level of the designer. Here there are seven specific structural patterns available for research. They are:
Facade, adapter, proxy, decorator, bridge, composite ),
Flyweight)
3. behavior mode
After the problem of object structure and object creation is solved, the object behavior problem is left. If the object behavior is well designed, the object behavior will be clearer, the efficiency of collaboration between them is
It will increase. Here there are 11 specific behavioral patterns available for research. They are:
Template Method, observer, state, strategy, chain of responsibility ),
Command, visitor, mediator, memento, iterator ),
Interpreter mode (Interpreter)
4. Differences
(1) The Singleton mode is the creation mode, and the meta mode is the structure mode. The Singleton mode and the meta mode both mean data sharing, but the singleton Mode means that everyone shares one thing, while the meta Mode means sharing multiple things.
(2) modes can be divided into class mode and object mode. Class mode uses inheritance and object mode uses delegation.
5.
(1) The policy mode is a behavior mode, and the bridge mode is a type of structural mode.
(2) The main significance of the Bridge Mode expression is the interface isolation principle, that is, to distinguish the two systems that are essentially not cohesive so that they can be loosely combined, policy decoupling is just an algorithm.
Level, not to the level of the system.
6. Both the appearance and the adapter are encapsulation of the existing system.
A new interface is defined to provide a more convenient access interface for the existing system.
The adapter is to reuse an existing interface, and the adapter is to make two existing interfaces work together
7. the main difference between proxy and appearance is that the proxy object represents a single object, and the appearance object represents a sub-system. The proxy client object cannot directly access the object, the proxy provides separate access to the target object,
The appearance object provides a simplified calling interface for the functions of each component of the subsystem.