The Catalog of Design Patterns 设计模式目录

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.

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

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 《Head First设计模式-深入浅出设计模式》是一本以简单有趣的方式介绍设计模式的书籍。设计模式是在软件开发中解决特定问题的一种经验总结,它们提供了在实际开发中可重用、可靠、灵活的解决方案。 该书的主要特点是通过生动有趣的讲解和丰富多样的图表、示例来帮助读者更好地理解和应用设计模式。作者采用了大量的图形和实例来解释设计模式的概念,使读者能够迅速理解并应用这些概念。 这本书涵盖了23种常用的设计模式,如工厂模式、单例模式、适配器模式、装饰器模式等。每一种设计模式都以一个实际的例子开始,引出该模式解决的问题,然后详细解释其结构和应用,最后通过示例代码展示如何使用该模式。 此外,该书还介绍了设计模式之间的关系和如何选择合适的设计模式。它教授了读者如何在具体问题中识别出适用的设计模式,并提供了一些实际的应用建议。 《Head First设计模式-深入浅出设计模式》以其独特的教学风格和简洁明了的讲解深受读者喜爱。这本书不仅适合初学者了解设计模式,也适合有一定经验的开发人员进一步提高他们的软件设计和编程能力。 总之,这本书以其生动有趣的讲解方式和大量的图表、实例为读者介绍了设计模式的基本概念和具体应用,是学习和理解设计模式的一本不可或缺的指南。 ### 回答2: 《Head First设计模式:深入浅出设计模式》是一本主要介绍软件设计模式的书籍。设计模式是在软件开发中经常出现的问题的解决方案,可以帮助开发人员更好地构建可重用、可扩展、可维护的代码。 这本书以深入浅出的方式介绍了23种常见的设计模式,通过生动有趣的讲解和大量的图形和实例,使读者能够更加轻松地理解和掌握设计模式。它采用了非传统的学习方式,通过讲故事、练习、谜题等方式将设计模式的概念和使用方法娓娓道来。 该书首先从简单的设计模式开始,引导读者逐步理解和掌握基础的设计原则和模式,如单例模式、工厂模式等。然后,逐渐深入介绍更复杂的模式,如装饰器模式、观察者模式、策略模式等。每个模式都通过具体的案例和代码示例进行讲解,帮助读者理解模式的思想和应用场景。 除了具体的设计模式之外,这本书还关注了如何将设计模式应用到现实的软件开发中。它探讨了如何根据不同的需求选择合适的设计模式,以及如何通过设计模式提高代码的质量和可维护性。 总的来说,《Head First设计模式:深入浅出设计模式》是一本非常有趣、易懂且实用的设计模式入门书籍。无论是初学者还是有一定经验的开发人员,都能从中获得有益的知识和经验,提高软件开发的能力和效率。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值