Category 23 kinds of GoF Design Patterns

GoF Design Patterns a total of 23. Generally by purpose and scope to be divided, in particular divided as follows:

First, these patterns by purpose (ie what kind of task completion) to create classified as type, structure type, and Behavioral three modes:

Creating type: used to create objects. Singleton, prototype, abstract factory, builders, factory methods which five belong to this classification. This category will be created with its use played an object separation decoupling.

Structural: How to deal with the combination between classes or objects to form larger structures. Bridging, decorative, adapters, agents, appearance, Flyweight, combination of these seven belong to this category.

Behavioral: how to deal with the interaction between class or object and assign responsibilities. Template method, the interpreter, strategy, order, chain of responsibility, states, observer, mediator, iterators, visitors memorandum which 11 belong to this category.

 

Second, its use is based on the object, or divided up, classes and objects can be divided into two modes.

Class models: mainly used to handle between class and its subclass inheritance relationship that is determined at compile time, runtime is static and unchanging. Factory method, the template method (s) adapters, four interpreter which belong to this category.

Object Mode: composition for treating or polymeric relationships between objects may be varied runtime dynamic. 19 kinds of other fall into this pattern. Specifically shown below.

These two horizontal and vertical directions as classification may be a specific pattern classification column of the following table.

 

23 kinds of GoF Design Patterns Classification

    purpose

range

Creating type / Creational

Structural / Structural

Behavioral / Behavioural

Type / Class

Factory method / Factory Method

Adapter (class) / Adapter (class)

Interpreter / Interpreter

Template Method / Template method

Object Type / Object

Singleton / Singleton

Prototype / Prototype

Abstract Factory / Abstract Factory

Builder / Builder

Bridge / Bridge

Decoration / Decorator

Proxy / Proxy

Appearance / Facade

Flyweight / Flyweight

Combination / Composite

Adapter (Object) / Adapter (object)

Chain of Responsibility / Chain of Responsibility

Command / Command

Observer / Observer

Mediator / Mediator

State / State

Visitors / Visitor

Iterator / Iterator

Memorandum Memento

Policy / Strategy

 

 

Note: general beginners, because remember more difficult to remember, I is the original sentence memory configuration according to a first word taken homonym each mode, with the back italics underlined is the class model, although some errors by, but the effect is obvious. If the in-depth understanding, it will naturally be divided according to the name, so you do not need to remember.

Create Type: pumping unit construction method  -> single embodiment, prototype, abstract factory, builder, factory method .

Structural: posing (after) stay (in) an outer (surface) image progenitor division (Ye) -> Bridge, decorative, agents, appearance, Flyweight, combination, an adapter (object or class)

Behavior: In addition to over-all behavior in front of the type. Or as follows:

             The audience well-known anti-loading disc under test (test with) mustard  -> chain of responsibility, command, observer, mediator, state, iterators, visitors, memos, policy, interpreter, template method

 
 

Guess you like

Origin www.cnblogs.com/markkang/p/11823615.html