Summary of 23 Design Patterns

Source: Internet
Author: User
Abstract Factory Provides an interface for creating series-related or mutually dependent objects without specifying their specific classes.
Adapter Converts an interface of a class to another interface that the customer wants. Which classes cannot work together due to interface incompatibility?
Bridge Separate the abstract part from its implementation part so that they can all change independently.
Builder Separates the construction of a complex object from its representation so that different representations can be created during the same construction process.
Chain of responsibility To remove the coupling between the requester and the sender, multiple objects have the opportunity to process the request. Connect these objects into a chain and pass them down until an object processes them.
Command Encapsulate a request as an object so that different requests are parameterized to the customer. Request queuing or logging and cancelling operations are supported.
Composite Combine objects into a tree structure to represent the "part-whole" hierarchy. Composite makes the customer's use of a single object and composite object consistent
Decorator Dynamically add some additional responsibilities to an object. In terms of the extended functions, the decorator mode is more flexible than the subclass generation method.
Facade Provides a consistent interface for a group of interfaces in the subsystem. The facade mode defines a high-level interface, which makes the subsystem easier to use.
Factory method Defines an interface for creating objects, so that the subclass determines which class to instantiate. Factory method makes
Flyweight Use the sharing technology to effectively support a large number of fine-grained objects.
Interpreter Given a language, it defines a syntax expression and an interpreter that uses this representation to interpret sentences in the language.
Iterator Provides a method to sequentially access each element in an aggregate object and define an interpreter used to interpret sentences in a language.
Mediator An intermediary object is used to encapsulate a series of object interactions. The intermediary makes objects do not need to be displayed and referenced to each other, so that coupling is loose and interaction between objects can be changed independently.
Memento (Memorandum) Capture the internal state of an object without compromising encapsulation, and save the state outside the object. In this way, the object can be restored to the Saved state.
Observer Defines a one-to-many dependency between objects so that when the status of an object changes, all objects dependent on it are notified and automatically updated.
Prototype Use a prototype instance to specify the type of the object to be created, and copy the prototype to create a new object.
Proxy Provide a proxy for other objects to control access to this object.
Singleton Ensure that a class has only one instance and provides a global access point.
State Allows an object to change its behavior when its internal state changes. The object seems to have modified its class.
Stragey Define a series of algorithms, encapsulate them one by one, and enable them to replace each other. This mode makes algorithm changes independent of customers who use it.
Template Method Defines the algorithm skeleton in an operation and delays some steps to the subclass. The template method allows the subclass to redefine certain steps of an algorithm without changing the structure of an algorithm.
Visitor An operation that acts on elements in an object structure. It allows you to define new operations on these elements without changing the classes of each element.

Summary of 23 Design Patterns

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.