I. 3 category Design Patterns: Created, structured, behavioral.
A.5 Model: Factory method, abstract factory, Singleton, builder, prototype.
B.7 Model: Adapter, decorator, agent, appearance, bridging, combination, and enjoy.
c.11 Behavioral Patterns: Strategies, template methods, observers, iterations, chains of responsibility, commands, memos,
State, visitor, mediator, interpreter.
Note: In addition to the above 3 categories, there are another 2 types of design patterns: and hairstyles, thread pool.
Two. Design mode 6 major principles: Open and Close, the Richter substitution, dependence reversal, interface isolation, Dimitri (least known), synthetic multiplexing.
A. Open and close: to expand development, to modify the closure. When the program is expanded, the original code cannot be modified, and we need to use interfaces and abstract classes.
B. Richter substitution (LSP): One of the fundamental principles of object-oriented design, supplemented by the principle of closure. Where any base class can appear, subclasses must appear. Subclass inherits the base class, without affecting the base class, adding new methods and functions, the base class code can be reused.
C. Dependency reversal: The basis of the open and close principle, programming for the interface, depends on the abstraction does not depend on the specific.
D. Interface isolation: Using multiple isolation interfaces is better than using a single interface.
E. Dimitri (least known): An entity should have as few interactions as possible with other entities, making the system function modules relatively independent.
F: Synthetic multiplexing Principle: use synthesis/aggregation as much as possible instead of inheritance.
Three. 23 Design modes.
1.3 Plant Method modes: General factory, multiple plant methods.
A. General factory: Establish a factory class to create an instance of the class that implements the same interface.
Parent interface:
Public Interface sender{ publicvoid Send ();
Implementation class:
Public class Implements sender{ @Override publicvoid , Send () { System.out.println ("This is mailsender! " ); }}
Java 23 design pattern learning.