23 Pattern Designs

Source: Internet
Author: User
Abstract Factory (): provides an interface for creating a series of related or mutually dependent objects without specifying their specific classes.
A d a p t Er (): converts an interface of a class to another interface that the customer wants. The A d a p t e r mode makes those classes that cannot work together due to interface incompatibility work together.
B r I d G E (): separates abstract parts from their implementations so that they can all change independently.
B u I l d e r (): separates the construction of a complex object from its representation so that different representations can be created during the same build process.
Chain of responsibility (): to cancel the coupling between the request sender and receiver, multiple objects have the opportunity to process the request. Connect these objects into a chain and pass the request along the chain until an object processes it.
C o m a n d (5. 2): encapsulate a request as an object so that you can parameterize the customer with different requests, queue requests or record request logs, and support cancelling operations.
C o m p o s I t e (): combines objects into a tree structure to represent the "part-whole" hierarchy. C o m p o s I t e makes the customer's use of a single object and composite object consistent.
D e c o r a t o r (4. 4): dynamically add some additional responsibilities to an object. In terms of extended functions, the d e c o r a t o r mode is more flexible than the subclass method.
F a c a d e (4. 5): provides a consistent interface for a group of interfaces in the subsystem. The f a c a d e 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 delays the instantiation of a class to its subclass.
F l y w e I g h t (): Use sharing technology to effectively support a large number of fine-grained objects.
I n t e r P R E T E R (5. 3) given a language, define a representation of its syntax and define an interpreter that uses this representation to interpret sentences in the language.
I t e r a t o r (): provides a method to access each element in an aggregate object sequentially without exposing the internal representation of the object.
M e d I a t o r (5.5): encapsulate a series of object interactions with an intermediary object. The intermediary makes the objects do not need to be explicitly referenced to each other, so that the coupling is loose and the interaction between them can be changed independently.
M e n t o (): 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.
O B S E R v e r (5. 7): defines a one-to-many dependency between objects, so that when the status of an object changes, all objects dependent on it will be notified and automatically refreshed.
P r o t y p e (3. 4): specify the type of the object to be created using the prototype instance, and create a new object by copying the prototype.
P r o x y (4.7): provides a proxy for other objects to control access to this object.
S I n g L E t o n (): ensures that a class has only one instance and provides a global access point to it.
S t a t e (5.8): allows an object to change its behavior when its internal state changes. The object seems to have modified its class.
S t r a t e g y (): defines a series of algorithms, encapsulates them one by one, and makes them replaceable. This mode makes the algorithm changes independent of the customers who use it.
Template Method (): defines the skeleton of an algorithm 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.
Vi S I t o r (): an operation that acts on each element in an object structure. It allows you to define new operations that act on these elements without changing the classes of each element.

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.