One of the most important aspects of writing easy-to-maintain code is the ability to find and optimize the body of code that recurs. This is also a valuable part of the design pattern.
Design Pattern Categories:
First, the creation of design patterns
Creation design pattern partitioning focuses on working with object creation mechanisms to create objects in a way that is appropriate for a given situation. The basic approach to creating objects can lead to an increase in project complexity, which is designed to address this problem by controlling the creation process.
Can be broadly divided into:
- Constructor (constructor)
- Factory (Factory)
- Abstract (abstraction)
- Prototype (prototype)
- Singleton (single case)
Builder (builder)
Second, structural design mode
Structured design patterns are related to object combinations and can often be used to identify simple ways to establish relationships between different objects. This pattern helps ensure that the entire structure of the system does not need to change at the same time when a change is made to a certain part of the system, and that this pattern can help them complete the reorganization for parts of the system that are not suitable for a particular purpose.
Patterns that fall into this category include:
- Decorator (decorator)
- Facade (appearance)
- Flyweight (enjoy Yuan)
- Adapter (Adapter)
- Proxy (agent)
Iii. Patterns of behavior
Behavioral patterns focus on improving or simplifying communication between different objects in the system.
Behavior patterns include:
- Iterator (iterator)
- Mediator (intermediary)
- OBSERVER (Observer)
- Visitor (visitor)
JavaScript Design Patterns Research Learning-Design pattern categories