Delegate pattern
The delegate pattern is responsible for the invocation and assignment of tasks
The DispatcherServlet in Spring MVC uses the delegate pattern
The strategy pattern
Application scenarios
-
There are many classes in the system, and they differ only in their behavior
-
A system needs to dynamically choose one of several algorithms (business scenario of choosing payment method)
Policy patterns are implemented through container singleton patterns and factory patterns
In the JDK, the commonly used compare method is a policy schema
Template pattern
Implement the invariant parts of an algorithm once and leave the mutable behavior to subclasses
Extract common behavior to avoid code duplication
JDBC operations
Adapter mode
Reconstruct the service scenario for free third-party login
Decorator pattern
Attach functionality to an object without changing the original object
Similar to static proxies, but instead of enhancing methods, it adds functionality to objects
Observer model
Also known as publish and subscribe