《設計模式——可複用物件導向軟體的基礎》學習筆記(1.5)Organizing the catalog...

鍾超發表於2011-11-26
1.Classify DPs by purpose.
(1)Creational DP: the process of object creation.
Factory Method, Abstract Factory, Builder, Prototype, Singleton


(2)Structural DP: composition of classes or objects.
Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy


(3)Behavioral DP: the way in which classes or objects interact and distribute responsibility.
Interpreter, Template Method, Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Visitor.


2.Classify DPs by scope
(1)Class DP: Deal with relationships between classes and their subclasses.
Factory Method, Adapter(Class), Interpreter, Template Method.


(2)Object DP: Deal with object relationships, which can be changed at run-time and are more dynamic.
Abstract Factory, Builder, Prototype, Singleton, Adapter(Object), Bridge, Composite, Decorator, Facade, Flyweight, Proxy, Chain of Responsibility, Command, Iterator, Mediator, Memonto, Observer, State, Strategy, Visitor


3.Classify DPs by purpose and scope.
(1)Creational Class DPs: Defer some part of object creation to subclasses.
Factory Method.


(2)Creational Object DPs: Defer some part of object creation to compose classes.
Abstract Factory
Builder
Prototype
Singleton


(3)Structural Class DPs: Use inheritance to compose classes.
Adapter(Class)


(4)Structural Object DPs: Describe ways to assemble objects.
Adapter(Object)
Bridge
Composite
Decorator
Facade
Flyweight
Proxy


(5)Behavioral Class DPs: Use inheritance to describe algorithms.
Interpreter
Template Method


(6)Behavioral Object DPs: Describe how a group of objects cooperate to perform a task that no single object can carry out alone.
Chain of Responsiblity
Command
Iterator
Mediator
Memento
Observer
State
Strategy
Visitor


4.Having multiple ways of thinking about patterns will deepen your insight into what they do, how they compare, and when to apply them.

相關文章