- 1. Singleton mode
Ensure that there is only one instance of a class. It instantiates itself and provides the entire instance to the entire system.
- 2. Factory mode
Define an interface for creating objects and let subclasses decide which class to instantiate. The factory method delays the instantiation of a class to its subclasses.
-
- Abstract Factory pattern
Provides an interface for creating a set of related or interdependent objects. And there is no need to specify their concrete classes.
-
- Template method
A framework that defines an algorithm in an operation, deferring some steps to subclasses. Allows subclasses to redefine specific steps of an algorithm without changing its structure.
-
- Builder model
Separating the construction of a complex object from its representation allows the same construction process to create different representations.
-
- The proxy pattern
Provide a proxy for other objects to control access to this object.
-
- The prototype pattern
Specify what kind of objects to create with prototype instances, and create new objects by copying these prototypes.
- 8. The Mediator model
By encapsulating a set of object interactions with a mediation object, the mediator loosens the coupling by allowing objects to interact without explicitly, and can change their interactions independently.
-
- Command mode
Encapsulating a request as an object allows you to parameterize clients with different requests, queue requests or log requests, and provide command undo and recovery capabilities.
-
- Chain of Responsibility model
This avoids coupling between the sender and receiver of the request by giving multiple objects the opportunity to process the request. Connect the objects into a chain and pass the request along the chain until an object handles it.
-
- Decorative pattern
Add some extra responsibilities to an object dynamically. Decorator patterns are more flexible in terms of adding functionality than subclassing.
-
- The strategy pattern
Define a set of algorithms, encapsulate each algorithm, and make them interchangeable.
-
- Adapter mode
Transform the interface of one class into another that the client expects, so that two classes that would otherwise not work together because of interface mismatches can work together.
-
- Iterative model
It provides a way to access elements in a container object without exposing the inner details of the object.
-
- Portfolio model
Objects are grouped into a tree structure to represent a partial-whole hierarchy, allowing consistency in the use of individual objects and composite objects.
-
- Observer model
Define a one-to-many dependency between objects so that whenever an object changes state, all dependent objects are notified and automatically updated.
-
- Facade pattern
It is required that communication between the outside and the inside of a subsystem must be carried out through a unified object. Facade mode provides a high-level interface that makes subsystems easier to use.
-
- Memo mode
Capture the internal state of an object and store the state outside of the object without breaking encapsulation. This allows you to later restore the object to its original saved state.
-
- Visitor pattern
Encapsulates operations that operate on elements of a data structure and defines new operations that operate on those elements without changing the data structure.
-
- The state pattern
Allowing an object to change its behavior when its internal state changes, the object looks like it has changed its class.
-
- Interpreter mode
Define a language, define a representation of its grammar, and define an interpreter that uses that representation to interpret sentences in the language.
-
- The flyweight pattern
Using shared objects effectively supports a large number of fine-grained objects.
-
- Bridge pattern
Decouple the abstraction from the implementation so that both can vary independently.