Usage Frequency |
Type |
Mode name |
Mode |
Simple definition |
5 |
Creation type |
Singleton |
Single Piece |
Ensure that a class has only one instance and provides a global access point to it. |
5 |
Structural |
Composite |
Combination Mode |
The object is combined into a tree structure to represent the relationship between the entire part. Composite makes the use of a single object and a composite object consistent. |
5 |
Structural |
Fa? Ade |
Appearance |
Provides a consistent interface for a group of interfaces in the subsystem, fa? Ade provides a high-level interface, which makes the subsystem easier to use. |
5 |
Structural |
Proxy |
Proxy |
Provides a proxy for other objects to control access to this object. |
5 |
Behavior Type |
Iterator |
Iterator |
Provides a method to access each element of an aggregate object sequentially without exposing the internal representation of the object. |
5 |
Behavior Type |
Observer |
Observer |
Define one-to-multiple dependencies between objects. When the status of an object changes, all objects dependent on it are automatically updated. |
5 |
Behavior Type |
Template Method |
Template Method |
DefineAlgorithmAnd some steps are delayed to the subclass. The templatemethod allows the subclass to redefine certain steps of the Algorithm without changing the structure of an algorithm. |
4 |
Creation type |
Abstract Factory |
Abstract Factory |
Provides an interface for creating a series of related or mutually dependent objects without specifying their specific classes. |
4 |
Creation type |
Factory method |
Factory method |
Define an interface used to create objects so that the subclass determines which class to instantiate. The factory method delays the instantiation of a class to the subclass. |
4 |
Structural |
Adapter |
Adapter |
The adapter mode converts a class-1 interface to another interface that the customer wants. The adapter mode makes those classes unable to work together due to incompatibility of the interface. |
4 |
Structural |
Decrator |
Decoration |
Dynamically add some additional responsibilities to an object. In terms of the added functions, the decorator mode is more flexible than the subclass generation. |
4 |
Behavior Type |
Command |
Command |
Encapsulate a request as an object so that you can parameterize the customer with different requests, queue requests, record request logs, and support auditable operations. |
4 |
Behavior Type |
State |
Status |
Allows an object to change its behavior when its internal state changes. The object seems to have changed its class. |
4 |
Behavior Type |
Strategy |
Rule Mode |
Define a series of algorithms, encapsulate them one by one, and enable them to replace each other. This mode allows algorithms to be independent of customers who use them. |
3 |
Creation type |
Builder |
Generator |
Separates the construction of a complex object from its representation, so that different representations can be created during the same construction process. |
3 |
Structural |
Bridge |
Bridging |
Separate the abstract part from its implementation part so that they can change independently. |
3 |
Behavior Type |
China of responsibility |
Responsibility chain |
Allow multiple objects to process requests, so as to avoid coupling between the request sender and receiver. |
2 |
Creation type |
Prototype |
Prototype |
Use a prototype instance to specify the type of the object to be created, and copy the prototype to create a new object. |
2 |
Structural |
Flyweight |
Share |
|
2 |
Behavior Type |
Mediator |
Intermediary |
Encapsulate object interaction of some columns with an intermediary object. |
2 |
Behavior Type |
Visitor |
Visitor Mode |
An operation that acts on each element in an object structure. It allows you to define a new operation that acts on this element without changing the element classes. |
1 |
Behavior Type |
Interpreter |
Interpreter |
Given a language, it defines a representation of its syntax and an interpreter that uses this representation to explain sentences in the language. |
1 |
Behavior Type |
Memento |
Memorandum |
Capture the internal state of an object without interrupting the object, and save the state outside the object. |