Creating mode
Static factory pattern (Factory Pattern) static method returns instance
Abstract Factory Pattern interface method returns instance
Builder Pattern returns multiple instances at a time
There is only one instance of the Singleton Pattern class
Prototype Pattern implements ICloneable interface
Structural mode
Adapter Pattern does not want to implement each interface
Bridge Pattern Sets an instance for the bridge and calls the instance method with the bridge
Filter mode (Filter, Criteria Pattern) filters collections by condition
Composite Pattern tree structure, including parent and child nodes
Decorator Pattern adds some decoration to the method
Facade Pattern computer and CPU, memory relationship
Is Flyweight Pattern similar to threadpool management threads?
Proxy Pattern cannot modify a method, inherit the class to extend the method
Behavioral Patterns
The Chain of Responsibility Pattern receiver contains a reference from another receiver. If an object cannot process the request, it will pass the same request to the next receiver.
Command Pattern data driver, wrapped in an object in the form of a command and passed to the calling object
Interpreter Pattern implements an expression interface that explains a specific context. This pattern is used in SQL parsing, symbol processing engines, etc.
Iterator pattern (Iterator Pattern) implements collection class, iterator
Mediator Pattern reduces the complexity of communication between multiple objects and classes. This pattern provides a mediator class that usually handles communication between different classes and supports loose coupling, making the code easy to maintain.
Memento Pattern backups a data, which can be restored later.
Observer Pattern delegate method call
State Pattern calls different methods according to state
The default behavior of Null Object Pattern in empty state
Strategy Pattern add, substract class implements the calculation interface, and uses an auxiliary class to implement calculations.
Template Pattern abstract class uses a seal method to call other virtual methods, and virtual methods are implemented in subclasses.
Visitor Pattern accepts visitor to call its own method through the accept (visitor) method
The above is all the content of this article. I hope that the content of this article will help you study or work. I also hope to support me more!