The Catalog of Design Patterns 设计模式目录

来源:互联网 发布:好看的韩国电影 知乎 编辑:程序博客网 时间:2024/05/16 06:10

The Catalog of Design Patterns    设计模式目录

 

The catalog beginning on page 93 contains23 design patterns. Their names and intents are listed next to give you an overview. The number in parentheses aftereach pattern name gives thepage number for the pattern (a convention we follow throughout the book).

设计模式目录

这个目录从93页开始包含了23中设计模式。接下来介绍了模式名称和说明,给出一个总的概括。每一个设计模式名字后的圆括号里的数字表示该设计所在的页码。

Abstract Factory (99)

Provide an interface for creating familiesof related or dependent objects without specifying their concreteclasses.

抽象工厂模式: 为创建一组相关或相互依赖的对象提供一个接口,而且无需指定他们的具体类

Adapter (157)

Convert the interface of a class intoanother interface clients expect. Adapter lets classes work together thatcouldn't otherwise because of  incompatible interfaces.

适配器模式:转换类的接口成为客户希望的另一个接口。Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。

Bridge 

Decouple an abstraction from itsimplementation so that the two can vary independently.

桥接模式:减弱抽象的办法以至于两个能独立的变化

Builder (110)

Separate the construction of a complexobject from its representation so that the same construction process cancreate different representations.

建造者模式:将一个复杂对象的构造与它的表示分离,使同样的构建过程可以创建不同的表示

 Chainof Responsibility (251)

Avoid coupling the sender of a request toits receiver by giving more than one object a chance to handle therequest. Chain the receiving objects

and pass the request along the chain untilan object handles it.

职责链模式:为解除请求的发送者和接收者之间耦合,而使多个对象都有机会处理这个请求。请求在这个链上传递,直到链上的某一个对象决定处理此请求。

Command (263)

Encapsulate a request as an object, therebyletting you parameterize clients with different requests, queue orlog requests, and support undoable operations.

命令模式:将一个请求封装为一个对象,从而使你可用不同的请求对客户进行参数化;对请求排队或记录请求日志,以及支持可取消的操作。

Composite (183)

Compose objects into tree structures torepresent part-whole hierarchies. Composite lets clients treatindividual objects and compositions of objects uniformly.

组合模式:将对象组合成树形结构以表示“部分-整体”的层次结构。它使得客户对单个对象和复合对象的使用具有一致性。

Decorator (196)

Attach additional responsibilities to anobject dynamically. Decorators

provide a flexible alternative tosubclassing for extending functionality.

装饰模式:动态地给一个对象添加一些额外的职责。就扩展功能而言,它比生成子类方式更为灵活。

Facade (208)

Provide a unified interface to a set ofinterfaces in a subsystem. Facade defines a higher-level interface that makesthe subsystem easier to use.

外观模式:为子系统中的一组接口提供一个一致的界面, F a c a d e模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。

Factory Method (121)

Define an interface for creating an object,but let subclasses decide which class to instantiate. Factory Methodlets a class defer instantiation

to subclasses.

工厂模式:定义一个用于创建对象的接口,让子类决定将哪一个类实例化。Factory Method使一个类的实例化延迟到其子类。

Flyweight (218)

Use sharing to support large numbers offine-grained objects efficiently.

享元模式:运用共享技术有效地支持大量细粒度的对象。

Interpreter (274)

Given a language, define a represention forits grammar along with an interpreter that uses the representation tointerpret sentences in the language.

解析器模式:给定一个语言,定义它的文法的一种表示,并定义一个解释器, 该解释器使用该表示来解释语言中的句子。

Iterator (289)

Provide a way to access the elements of anaggregate object sequentially without exposing its underlyingrepresentation.

迭代器模式:提供一种方法顺序访问一个聚合对象中各个元素, 而又不需暴露该对象的内部表示。

Mediator (305)

Define an object that encapsulates how aset of objects interact. Mediator promotes loose coupling by keepingobjects from referring to each

other explicitly, and it lets you varytheir interaction independently.

中介模式:用一个中介对象来封装一系列的对象交互。中介者使各对象不需要显式地相互引用,从而使其耦合松散,而且可以独立地改变它们之间的交互。

Memento (316)

Without violating encapsulation, captureand externalize an object's internal state so that the object can berestored to this state later.

备忘录模式:在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可将该对象恢复到保存的状态。

Observer (326)

Define a one-to-many dependency betweenobjects so that when one object changes state, all its dependents arenotified and updated automatically.

观察者模式:定义对象间的一种一对多的依赖关系,以便当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并自动刷新。

Prototype (133)

Specify the kinds of objects to createusing a prototypical instance, and create new objects by copying thisprototype.

原型模式:用原型实例指定创建对象的种类,并且通过拷贝这个原型来创建新的对象。

Proxy (233)

Provide a surrogate or placeholder foranother object to control access to it.

代理模式:为其他对象提供一个代理以控制对这个对象的访问。

Singleton (144)

Ensure a class only has one instance, andprovide a global point ofaccess to it.

单例模式:保证一个类仅有一个实例,并提供一个访问它的全局访问点。

State (338)

Allow an object to alter its behavior whenits internal state changes.The object will appear to change its class.

状态模式:允许一个对象在其内部状态改变时改变它的行为。对象看起来似乎修改了它所属的类。

Strategy (349)

Define a family of algorithms, encapsulateeach one, and make them interchangeable. Strategy lets thealgorithm vary independently from clients that use it.

策略模式:定义一系列的算法,把它们一个个封装起来, 并且使它们可相互替换。本模式使得算法的变化可独立于使用它的客户。

Template Method (360)

Define the skeleton of an algorithm in anoperation, deferring some steps to subclasses. Template Method letssubclasses redefine certain steps

of an algorithm without changing thealgorithm's structure.

模板方法模式:定义一个操作中的算法的骨架,而将一些步骤延迟到子类中。Template Method使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤。

Visitor (366)

Represent an operation to be performed onthe elements of an object structure. Visitor lets you define a newoperation without changing the classes of the elements on which itoperates.

访问者模式:表示一个作用于某对象结构中的各元素的操作。它使你可以在不改变各元素的类的前提下定义作用于这些元素的新操作。

 

 

 

 

 

原创粉丝点击