Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.(提供一种方法,访问一个容器对象中各个元素,而又不需要暴露该对象的内部细节。)
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.(给定一门语言,定义它的文法的一种表示,并定义一个解释器,该解释器使用该表示来解释语言中的句子。)
Attach additional responsibilities to an object dynamically keeping the same interface. Decorators provide a flexible alternative to subclassing for extending functionality.(动态的给一个对象添加一些额外的职责。就增加功能来说,装饰模式想比生成子类更为灵活。)
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.(定义一个操作中的算法的框架,而将一些步骤延迟到子类中。使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤。)
Provide an interface for creating families of related or dependent objecets without specifying their concrete classes.(为创建一组相关或者相互依赖的对象提供一个接口,而且无须指定它们的具体类。)