Summary of basic concept of design pattern
1. Simple Factory mode (Static Factory method)
A simple factory model is a factory object that determines which product class instances are created. Simple Factory mode is the simplest and most practical mode in the factory model family, which can be understood as a special implementation of different factory patterns.
2. Strategy Mode (strategy)
It defines the algorithm family, individually encapsulated, so that they can be replaced by each other, this mode allows the algorithm to change, does not affect the use of the algorithm of the customer.
3. Decoration mode
Decorative mode (Decorator), which dynamically adds some additional responsibilities to an object, the adornment mode is more flexible than the generation of subclasses in terms of added functionality.
4. Proxy Mode
proxy mode, which provides a proxy for other objects to control access to this object .
5. Factory Method mode
Factory method Mode (Factory), which defines an interface for creating objects, so that subclasses decide which class to instantiate. The factory method defers the instantiation of a class to its subclasses.
6. prototype mode
Prototype mode (PROTOTYPE), which specifies the kind of object created with the prototype instance, and creates a new object by copying the prototypes.
7. Template Method mode
The template method pattern, which defines the skeleton of an algorithm in an operation, delays some steps into subclasses. The template method allows subclasses to redefine some specific steps of the algorithm without altering the structure of an algorithm.
8. Appearance mode
Appearance mode (facade), which provides a consistent interface for a set of interfaces in a subsystem that defines an advanced interface that makes this subsystem easier to use.
9. Builder Mode
Builder mode, which separates the construction of a complex object from its representation, so that the same build process can create different representations.
Viewer mode
The Observer pattern defines a one-to-many dependency that allows multiple observer objects to listen to a Subject object at the same time. This subject object notifies all observer objects when the state changes, enabling them to automatically update themselves.
Abstract Factory mode
Abstract Factory, which provides an interface for creating a series of related or interdependent objects without specifying their specific classes.
State mode
State mode, which, when an object's internal state changes, allows it to change its behavior, and the object looks like it has changed its class.
Adapter mode
Adapter mode (Adapter), which transforms the interface of a class into another interface that the customer wants. The adapter mode makes it possible for those classes that would otherwise not work together because of incompatible interfaces to work together.
Memo mode
Memo (Memento): captures the internal state of an object without compromising encapsulation, and saves the state outside that object. The object can then be restored to its previously saved state.
Combined mode
Combination mode (Composite), which combines objects into a tree structure to represent the ' Department-Whole ' hierarchy. The combined mode makes the user consistent with the use of individual objects and composite objects.
The iterator mode
An iterator pattern (Iterator) that provides a way to sequentially access individual elements in an aggregated object without exposing the object's internal representation.
single case mode
Singleton mode (Singleton), which guarantees that a class has only one instance, and provides a global access point to access it.
Bridge mode
Bridging mode (bridge), separating the abstract part from its implementation, so that they can vary independently.
. Command mode
Command mode, which encapsulates a request as an object, so that you can parameterize the customer with different requests, queue requests or log requests, and support revocable operations.
responsibility chain Model
The responsibility chain pattern (Chain of Responsibility) enables multiple objects to have the opportunity to process requests, thus avoiding the coupling between the sender of the request and the receiver.
. Broker Mode
The mediator pattern (mediator), which encapsulates a series of object interactions with a mediation object. The mediator makes the objects not need to explicitly reference each other, so that they are loosely coupled, and can independently change the interaction between them.
. enjoy meta mode
Enjoy meta-mode (Flyweight), using sharing technology to effectively support a large number of fine-grained objects.
. Interpreter Mode
The interpreter pattern (interpreter), given a language, defines a representation of its grammar, and defines an interpreter that uses that representation to interpret the sentences in the statement.
Visitor mode
The visitor pattern (Visitor), which represents an operation that acts on elements in an object structure. It allows you to define new actions that act on these elements without changing the class of each element.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Design pattern Notes--Summary of design pattern concept