Design mode classification

xiaoxiao2021-03-06  14

Common design patterns are divided into 23 modes:

Abstract Factory: Provides an interface that creates a series of associated or interdependent objects without specifying their specific classes.

Adapter: Converts a class to another interface that you want to make it works with those classes that are not compatible without compatibility.

Bridge: Separate the abstraction section to its achievement, so that it can vary independently.

CHAIN ​​of Responsibility: To release the coupling between the requested sender and the recipient, make multiple objects have the opportunity to handle this request. Connect these requests into a chain and pass the request along this chain until there is an object to handle it.

Command: Package a request into an object so that you can use different requests to parameterize the customer; queuing or logging the request log, as well as support that can be canceled.

Composite: Combine the object into a tree structure to represent a "part-overall" hierarchy. Composite makes the customer consistency for a single object and composite object.

Decorator: Dynamically add some additional responsibilities to an object. In terms of extension, Decorator is more flexible than generated subclasses.

FACADE: Provides a consistent interface for a set of interfaces in the subsystem, and the FACADE mode defines a high-level interface that makes this subsystem easier to use.

Factory method: Define an interface to create an object, let the subclass decide which class instantiate. Factory Method allows an instantiation of a class to a subclass.

Flyweight: Use sharing technology to effectively support a lot of fine-grained objects.

Interpreter: Given a language, defining a representation of its textual law, and defines an interpreter to explain a specific gram.

Iterator: Provides a method sequentially accessed various elements in a polymeric object without exposing internal representation of the object.

Mediator: Use a mediation object to encapsulate a series of object interactions. The intermediaries make the objects need not be referenced to each other, making the coupling loose, can independently change interaction between each other.

MEMENTO: Under the premise of the package, capture the internal state of the object and save this status outside of the object.

Observer: Defines a one-to-many dependency between objects to get notifications and refresh depending on its objects when the status of an object changes.

Prototype: Specify the type of the object with a prototype instance and create a new object by copying this prototype.

Proxy: Provides a proxy for other objects to control access to this object.

Singleton: Ensure that a class has only one instance and provides a global point access to it.

State: Allows an object to change its behavior when the internal state changes. Objects seem to have modified the class to which you belong.

Strategy: Defines a series of algorithms to encaps them and replace them, so that the algorithm is independent of the customer.

Template Method: Defines the algorithm skeleton in an operation, and delays the specific implementation of these algorithms to the subclass.

Visitor: Identify an operation of each element in an object structure, defining a new operation that acts on this element without changing the class of each element.

转载请注明原文地址:https://www.9cbs.com/read-67796.html

New Post(0)