Design Patterns: scenarios where common design patterns apply

Source: Internet
Author: User

Design Patterns: scenarios where common design patterns apply

Reference: http://blog.csdn.net/longronglin/article/details/1454315

Frequency Owning type Schema name Mode Simple definition
5 create singleton single-piece Ensure that a class has only one instance and provides a global access point to access it.
5 structural type combined mode Combining objects into a tree structure to represent a partial overall relationship, composite makes the user consistent with the use of individual objects and composite objects.
5 structural type appearance provides a consistent interface for a set of interfaces in a subsystem, facade provides a high-level interface that makes subsystems easier to use.
5 structural type proxy Provides a proxy for other objects to control access to this object
5 behavioral iterator provides a way to sequentially access individual elements of an aggregated object without exposing the object's internal representation.
5 behavioral viewer defines a one-to-many dependency between objects, and when an object's state changes, all objects that depend on it are notified of Automatic Updates.
5 behavioral Template method The skeleton of an algorithm in an operation is defined, and some steps are deferred to a subclass, and the Template method allows subclasses to redefine the algorithm's specific steps without altering the structure of an algorithm.
4 create type abstract factory provides an interface that creates a series of related or interdependent objects without specifying their specific classes.
4 create type factory method Define an interface for creating objects, so that subclasses decide which class to instantiate, Factory method causes the instantiation of a class to be deferred to subclasses.
4 structural type adapter converting a class of interfaces into another interface that the customer wants, the adapter mode makes it possible for those classes to work together because the interface is incompatible.
4 structural type decorate dynamically adds some additional responsibilities to an object, and in terms of added functionality, the decorator mode is more flexible than generating subclasses.
4 behavioral command encapsulates a request as an object, allowing you to parameterize the customer with different requests, queue requests and log requests, and support revocable operations.
4 behavioral status allows an object to change his behavior when its internal state changes. The object seems to have changed his class.
4 behavioral policy mode Define a series of algorithms, encapsulate them one by one, and allow them to replace each other, this mode allows the algorithm to be independent of the customers who use them.
3 create type generator Separating the construction of a complex object from his presentation allows the same build process to create different representations.
3 structural type bridge Separating the abstract part from its implementation so that they can change independently.
3 behavioral Responsibility responsibility chain so that multiple objects have a chance to process the request, This avoids the coupling relationship between the communicated and receiver of the request
2 create type prototype
2 structural type $
2 behavioral mediator Encapsulates object interactions for some columns with a mediation object.
2 behavioral Visitor mode represents an operation that acts on elements in an object's structure, allowing you to define new actions that act on this element without changing the individual element classes.
1 behavioral interpreter Given a language, define a representation of his grammar and define an interpreter that uses that representation to interpret the sentences in the language.
1 Behavioral type Memento Memo captures the internal state of an object without destroying the object, and saves the state outside the object.

Design Patterns: scenarios where common design patterns apply

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.