Design pattern (Design pattern) is a set of classification and cataloging summary of code design experience that is used repeatedly, known to most people. The purpose of using design patterns is to reuse code, make the code easier to understand by others, and ensure code reliability.
Generally speaking, design patterns are divided into three categories and 23 types:
Creational patterns, a total of five types: factory method pattern, abstract factory pattern, singleton pattern , builder mode, prototype mode.
There are seven structural modes: adapter mode, decorator mode, proxy mode, appearance mode, bridge mode, combination mode, and flyweight mode.
Behavioral patterns, eleven in total: strategy pattern, template method pattern, observer pattern, iterative sub pattern, chain of responsibility pattern, command pattern, memo pattern, state pattern, visitor pattern, mediator pattern , interpreter mode.
In fact, there are two categories: concurrent mode and thread pool mode.
Six principles of design patterns
1. Open Close Principle
2. Liskov Substitution Principle
3. Dependence Inversion Principle
4. Interface Segregation Principle
5. Demeter Principle (Demeter Principle)
6. Composite Reuse Principle
For more java knowledge, please pay attention to java basic tutorial.
The above is the detailed content of What are the java design patterns?. For more information, please follow other related articles on the PHP Chinese website!