23 design patterns
23 design patterns Design pattern (design pattern) is an important technology in software engineering. It is used to solve specific problems in a specific context. A universal solution is adopted. Design patterns can help software engineers improve code reusability, maintainability, and scalability. 23 common design patterns can be divided into the following categories: Creational patterns: These patterns are used to create objects, including factory method pattern, abstract factory pattern, singleton pattern, builder pattern and prototype pattern. Structural patterns: These patterns are used to organize the structure of classes and objects, including adapter pattern, bridge pattern, composition pattern, decorator pattern, appearance pattern, Flyweight mode and proxy mode. Behavioral patterns: These patterns are used to define the interaction and responsibility distribution between classes or objects, including chain of responsibility pattern, command pattern, interpreter pattern, Iterator pattern, Mediator pattern, Memo pattern, Observer pattern, State pattern, Strategy pattern, Template method pattern and Visitor pattern. Six principles of design patterns Single Responsibility Principle ( Single Responsibility Principle): A class should have only one reason for its change. Open and closed principle ( Liskov Substitution Principle): Software entities (classes, modules, functions, etc.) should be extensible but not modifiable. Richter Substitution Principle (Liskov Substitution Principle):…