JAVA design patterns-learning Summary (sequence), java Design Patterns
Design ModeDesign pattern is a summary of the code Design experience that has been used repeatedly. The design pattern is used to make code reusable, make it easier for others to understand, and ensure code reliability.
There are 23 common design patterns. There are three categories:
Creation Mode:Factory method mode,Abstract Factory mode,Singleton mode,Builder mode and prototype mode.
There are seven structural modes:Adapter mode, decorator mode, proxy mode,Appearance mode, bridging mode, combination mode, and metadata mode.
11 behavior models:Rule mode, template method mode, observer mode,Iteration submode, responsibility chain mode, command mode, memorandum mode, state mode, visitor mode, intermediary mode, interpreter mode.
Principle of design pattern-Open Close Principle (Open Close Principle)
The principle of opening/closing is to open the extension and disable the modification. When the program needs to be expanded, the original code cannot be modified, but the original code must be extended to achieve a hot swapping effect. The reason for this principle is to make the program scalable, easy to maintain and upgrade. To achieve this, we need to use interfaces and abstract classes.
Object-oriented thinking is the basis of the design model
There are many child classes involved in the pattern. After reading this document, we have selected several representative design patterns (frequently used ones marked as bold above) to discuss and learn. This is a general analysis. In the future, we will discuss in detail each design mode and give an example for verification.