您的位置:首页 > 编程语言 > Go语言

四巨头GoF的《设计模式》中23种设计模式的UML图 - 4 of 4

2013-01-25 21:31 609 查看
Singleton: Ensure a SINGLETON class only has one instance, and provide a global point of access to it.



State: Allow a CONTEXT object to alter its behavior when its internal STATE changes. The CONTEXT object will appear to change its class.






*Strategy: A STRATEGY defines a family of algorithms, encapsulate each one, and make them interchangeable by holding a STRATEGY in a CONTEXT. Strategy lets the algorithm vary independently
from clients that use it.




CCOR

5. Algorithmic dependencies.

7. Extending functionality by subclassing.

Facade: A FA?ADE provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.



CCOR

6. Tight coupling.

*Factory Method: A CREATOR defines an interface for creating an object in a factory method, but let a subclassed CONCRETE CREATOR decide which class to instantiate. Factory Method lets a
class defer instantiation to subclasses.




CCOR

1. Creating an object by specifying a class explicitly.

Flyweight: A FLYWEIGHT FACTORY uses sharing in a pool to support large numbers of fine-grained CONCRETE FLYWEIGHT objects efficiently.




Chain of Responsibility: Avoid coupling the sender of a request to its receiver by giving more than one HANDLER object a chance to handle the request. The HANDLER chains the receiving objects
by holding a successor HANDLER and pass the request along the chain until an object handles it.





CCOR

2. Dependence on specific operations.

6. Tight coupling.

7. Extending functionality by subclassing.

Command: A CONCRETE COMMAND encapsulates a request action in a RECEIVER as a CONCRETE COMMAND object, thereby letting an INVOKER parameterize clients with different requests, queue or log
requests, and support undoable operations in CONCRETE COMMANDS.





CCOR

2. Dependence on specific operations.

6. Tight coupling.

*Composite: A COMPOSITE composes COMPONENT objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual LEAF objects and compositions of COMPOSITE
objects uniformly.





CCOR

7. Extending functionality by subclassing.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: