GOF Classical Design Pattern Intent
GOF Classical Design Pattern Intent
Abstract Factory
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
抽象工厂
提供一系列相关或者是相互依赖的对象接口,而无需指定它们的具体类。
Adapter
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn 't otherwise because of incompatible interfaces.
适配器
将一个类的接口转换成客户希望的另外一个接口。适配器模式使得原本由于接口不兼容而不能在一起工作的那些类可以一起工作。
Bridge
Decouple an abstraction from its implementation so that the two can vary independently.
桥接
将抽象部分与实现部分相分离使得它们可以相互独立地变化。
Builder
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
生成器
将一个复杂对象的构造与它们的表示分离,使得同样的构造过程可以创建不同的表示。
Chain of Responsibility
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
职责链
使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的偶合关系。将这些对象连一个链,并沿着这条链传递该请求,直到有一个对象处理它为止。
Command
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
命令
将一个请求封装成为一个对象,从而使你可用不同的请求对客户进行参数化,对请求排队或者是记录请求日志,以及支持可撤销的操作。
Composite
Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
组合
将对象组合成树型结构以表示“部分-整体”的层次结构。组合模式使得客户对单个对象和组合对象的使用具有一致性。
Decorator
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
装饰
动态地给一个对象添加一些额外的职责。就增加功能来说,装饰模式相比生成子类更加灵活。
Façade
Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
外观
为子系统中的一组接口提供了一个一致的界面。外观模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。
Factory Method
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
工厂方法
定义用来创建对象的接口,让子类来决定实例化哪一个类。工厂方法使得一个类的实例化延迟到其子类。
Flyweight
Use sharing to support large numbers of fine-grained objects efficiently.
享元
运用共享技术有效地支持大量细粒度的对象。
Interpreter
Given a language, define a represention for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
解释器
给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言中的语句。
Iterator
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
迭代器
提供一种方法顺序访问一个聚合对象中各个元素,而又不需要暴露该对象的内部表示。
Mediator
Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
中介者
用一个中介对象来封装一系列对象的交互。中介者使各对象不需要显示的相互引用,从而使其偶合松弛,而且可以对立的改变它们之间的交互。
Memento
Without violating encapsulation, capture and externalize an object 's internal state so that the object can be restored to this state later.
备忘录
在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可将该对象恢复到原先保存的状态。
Observer
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
观察者
定义对象一对多的描述关系,当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新。
Prototype
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
原型
用原型实例来指定创建对象的种类,并且通过这些原型创建新的对象。
Proxy
Provide a surrogate or placeholder for another object to control access to it.
代理
为其它对象提供一个代理以控制这个对象的访问。
Singleton
Ensure a class only has one instance, and provide a global point of access to it.
单件
保证一个类只能有一个实例,并且提供一个访问它的全局访问点。
State
Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
状态
允许一个对象在其内部状态改变时改变它的行为。对象看起来似乎修改了它的类。
Strategy
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
策略
定义一系列的算法,把它们一个个封装,并且使它们可以相互替换。策略模式使得算法可独立于使用它的客户而变化。
Template Method
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm 's structure.
模板方法
定义一个算法的骨架,而将一些步骤延迟到子类中。模板方法模式使得子类可以不改变算法的结构即可重定义该算法的某些特定步骤。
Visitor
Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.
访问者
表示一个作用于某个对象结构中的各个元素的操作。访问者使得你可以在不改变各元素的类的前提下定义作用于这些类的操作。
Abstract Factory
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
抽象工厂
提供一系列相关或者是相互依赖的对象接口,而无需指定它们的具体类。
Adapter
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn 't otherwise because of incompatible interfaces.
适配器
将一个类的接口转换成客户希望的另外一个接口。适配器模式使得原本由于接口不兼容而不能在一起工作的那些类可以一起工作。
Bridge
Decouple an abstraction from its implementation so that the two can vary independently.
桥接
将抽象部分与实现部分相分离使得它们可以相互独立地变化。
Builder
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
生成器
将一个复杂对象的构造与它们的表示分离,使得同样的构造过程可以创建不同的表示。
Chain of Responsibility
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
职责链
使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的偶合关系。将这些对象连一个链,并沿着这条链传递该请求,直到有一个对象处理它为止。
Command
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
命令
将一个请求封装成为一个对象,从而使你可用不同的请求对客户进行参数化,对请求排队或者是记录请求日志,以及支持可撤销的操作。
Composite
Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
组合
将对象组合成树型结构以表示“部分-整体”的层次结构。组合模式使得客户对单个对象和组合对象的使用具有一致性。
Decorator
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
装饰
动态地给一个对象添加一些额外的职责。就增加功能来说,装饰模式相比生成子类更加灵活。
Façade
Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
外观
为子系统中的一组接口提供了一个一致的界面。外观模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。
Factory Method
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
工厂方法
定义用来创建对象的接口,让子类来决定实例化哪一个类。工厂方法使得一个类的实例化延迟到其子类。
Flyweight
Use sharing to support large numbers of fine-grained objects efficiently.
享元
运用共享技术有效地支持大量细粒度的对象。
Interpreter
Given a language, define a represention for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
解释器
给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言中的语句。
Iterator
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
迭代器
提供一种方法顺序访问一个聚合对象中各个元素,而又不需要暴露该对象的内部表示。
Mediator
Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
中介者
用一个中介对象来封装一系列对象的交互。中介者使各对象不需要显示的相互引用,从而使其偶合松弛,而且可以对立的改变它们之间的交互。
Memento
Without violating encapsulation, capture and externalize an object 's internal state so that the object can be restored to this state later.
备忘录
在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可将该对象恢复到原先保存的状态。
Observer
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
观察者
定义对象一对多的描述关系,当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新。
Prototype
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
原型
用原型实例来指定创建对象的种类,并且通过这些原型创建新的对象。
Proxy
Provide a surrogate or placeholder for another object to control access to it.
代理
为其它对象提供一个代理以控制这个对象的访问。
Singleton
Ensure a class only has one instance, and provide a global point of access to it.
单件
保证一个类只能有一个实例,并且提供一个访问它的全局访问点。
State
Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
状态
允许一个对象在其内部状态改变时改变它的行为。对象看起来似乎修改了它的类。
Strategy
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
策略
定义一系列的算法,把它们一个个封装,并且使它们可以相互替换。策略模式使得算法可独立于使用它的客户而变化。
Template Method
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm 's structure.
模板方法
定义一个算法的骨架,而将一些步骤延迟到子类中。模板方法模式使得子类可以不改变算法的结构即可重定义该算法的某些特定步骤。
Visitor
Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.
访问者
表示一个作用于某个对象结构中的各个元素的操作。访问者使得你可以在不改变各元素的类的前提下定义作用于这些类的操作。