Typically, a design pattern describes a proven viable option. These programs are very common, is a complete definition of the most commonly used model. The general pattern of four basic elements: pattern name (pattern name), the problem (problem), solution (solution), the effect (consequences).
Java design patterns common 23 kinds of the following:
1, the abstract factory pattern (Abstract Factory): to provide a series of related or interdependent to create the interface objects, and without specifying their specific type.
2, adapter mode (Adapter): A type of interface will be converted into a customer interface of hope. Adapter mode as a result of making the original interface is not compatible and can not work with the class can work together.
3, the bridge mode (Bridge): the abstract part of the realization of part of its separation, so that they can change independently.
4, the construction mode (Builder): to construct a complex object that with its separation of the building process so that the same can be said to create different.
5, the responsibility chain (Chain of Responsibility): requests for the lifting of the sender and the receiver between the coupling of multiple objects have the opportunity to deal with this request. These objects will be connected into a chain, and along this chain of transmission of the request until there is an object to deal with it.
6, command mode (Command): a request for an object package, which can be used different parameters to the request of customers; the request queue or the request to record the log, as well as support to cancel the operation.
7, synthetic mode (Composite): the object into a tree structure that "part - whole" hierarchy. It allows customers a single object and composite object has the consistency of the use.
8, decorative patterns (Decorator): an object to dynamically add some additional functions. On the extensions, the sub-class it generated a more flexible manner.
9, window mode (Facade): for a set of subsystem interface to provide a consistent interface, the definition of window pattern of a high-level interface, this interface makes the system easier to use.
10, the factory method (Factory Method): the definition of an interface used to create the object, so that sub-class which decided to instantiate a class. Factory Method to make an example of a class of delay to its subclass.
11, Flyweight pattern (Flyweight): the use of shared technology to effectively support a large number of fine-grained objects.
12, interpreter mode (Interpreter): given a language, the definition of a grammar it said, and the definition of an interpreter, the interpreter explained the use of the express language of the sentence.
13, iterative sub-model (Iterator): provide a way to visit a sequence of polymerization of the various elements of the object, and not exposed to the object's internal said.
14, the mediation model (Mediator): use of an intermediary object to package a series of interactive objects. Intermediaries so that the object does not need explicit internal said.
15, the memorandum mode (Memento): do not undermine the premise of encapsulation, capture the internal state of an object and the object outside the state of preservation. After this object can be restored to the state of preservation.
16, the observer model (Observer): the definition of the object of inter-dependence of a one-to-many relationship, so that when an object changes state, all depend on it have been notified of the object and automatically refresh.
17, the original model model (Prototype): create a prototype example of the specified object type, and copy the prototype through to create a new object.
18, proxy (Proxy): for other clients, a proxy to control access to this object.
19, single-case model (Singleton): to ensure that only one instance of a class and access it to provide a global access point.
20, the state model (State): allows an object to change in its internal state to change its behavior. Modify the object may seem the type to which it belongs.
21, Strategy Mode (Strategy): the definition of a series of algorithms, package them up one by one, and so that they can replace each other. Algorithm makes the model can be independent of changes in the use of its customers.
22, template patterns (Template Method): the definition of an operation of the skeleton algorithm, and some steps will be deferred to the subclasses. Template method subclasses can be made without changing the structure of an algorithm to re-define the specific steps of the algorithm.
23, the visitor pattern (Visitor): a role that a particular object structure of the operation of the various elements. The model can be achieved without changing the type of each element under the premise of the definition of the role of these elements in the new operation.