Simplicity is the essence of happiness. - Cedric Bledsoe
从而公开表示法这种模式提供了一种方法来访问聚合对象的元素从而无需公开其底层表示法 ConcreteIterator(具体迭代器) This class (a) implements the Iterator interface and (b) keeps track of the current position in the traversal(遍历) of the aggregate(集合). (这类(a)实现了迭代器接口和(b)在遍历的集合中,跟踪当前位置。) Iterator(迭代器) This class defines an interface for accessing and traversing(遍历) elements. (这个类定义了一个接口来访问和遍历元素。) ConcreteAggregate(具体的集合) This class implements the Iterator creation interface to return an instance of the proper Concrete...
发布于 5 years ago
27723
代表这种模式表示一个作用于某对象结构中的各元素的操作它允许您在其运作时不改变各元素的类情况下定义一个新的操作 ConcreteVisitor2(具体访问者2) This class implements each operation declared by Visitor. Each operation implements a fragment(碎片) of the algorithm defined for the corresponding class of object in the structure. ConcreteVisitor provides the context for the algorithm and stores its local state. This state often(['ɔfən, 'ɔftən, 'ɔ:-] 时常)accumulates (累积)results during(在…的时候) the traversal(遍历) of the structure. (这个类实现了访客所宣布的每个操作。每个操作实现了在...
发布于 5 years ago
27950
出现这种模式允许一个对象当其内部状态改变时来改变其行为对象看起来似乎修改了它所属的类 ConcreteStateB(具体状态B) This subclass implements a behaviour associated with a state of the Context. (这个子类实现了一个上下文状态相关的行为。) ConcreteStateA(具体状态A) This subclass implements a behaviour associated with a state of the Context. (这个子类实现了一个上下文状态相关的行为。) State(状态) This class defines an interface for encapsulating the behaviour associated with a particular([pə'tikjulə] 特定的) state of the Context. (这个类定义了一个接口用于封装一个上下文的特定状态相关联的行为。)...
发布于 5 years ago
26823
框架推迟某个该模式在一个操作中定义了算法的框架将某些步骤推迟到子类中它允许子类在不改变一个算法的结构的情况下重新定义某些步骤 ConcreteClass(具体类) This class implements the primitive(原始的,简单的) operations to carry out subclass-specific steps of the algorithm. (这个类给执行算法中子类特有的的步骤实现了简单的操作。) AbstractClass(抽像类) This class (a) defines abstract primitive operations that concrete subclasses define to implement steps of an algorithm, and (b) implements a template method defining the skeleton of an algorithm. (这类(a)定义了子类中具体的简单操作的抽象给算法的实施步骤,和(b)实现了...
发布于 5 years ago
27488
分离这个模式将从其实现中分离出一个抽象以便这两个可以单独改变 ConcreteImplementorB(具体实现B) This class implements the Implementor interface and defines its concrete implementation. (这个类实现实现者的接口和定义其具体实现。) ConcreteImplementorA(具体实现A) This class implements the Implementor interface and defines its concrete implementation. (这个类实现实现者的接口和定义其具体实现。) RefinedAbstraction(精确抽像接口) This class extends the interface defined by Abstraction. (这个类扩展由抽象定义的接口。) Implementor(实现) This class defines the interface...
发布于 5 years ago
26388
分离复杂的表示法这种模式将一个复杂对象的构建从其表示法中分离出来使得同样的构建过程可以创建不同的表示 Product(产品) This class (a) represents(代表) the complex object under construction. ConcreteBuilder builds the product's internal representation and defines the process by which it's assembled, and (b) includes classes that define the constituent(构成的) parts, including interfaces for assembling the parts into the final result. (这类(a)代表了复杂对象正在建设。ConcreteBuilder构建产品的内部表示和定义装配的过程,和(b)包含定义各个组成部分的类,包括为了部件组装成最终的结果的接口。) ConcreteBuilder(...
发布于 5 years ago
25189
决定该模式定义了一个创建对象的接口而让子类决定哪个类来实例化它允许一个类延迟实例化到子类 ConcreteCreator(具体创建者) This class overrides the factory method to return an instance of a ConcreteProduct. (这类覆盖了工厂方法返回一个ConcreteProduct的一个实例。) Creator(创建者) This class (a) declares the factory method, which returns an object of type Product. Creator may also define a default implementation of the factory method that returns a default ConcreteProduct object, and (b) may call the factory method to create a Product object. (这类(a)声...
发布于 5 years ago
27126
统一的这种模式给一个子系统中的一套接口提供了一个统一的接口它定义了一个更高级别的接口使子系统更容易使用 SubsystemClass7 This class (a) implements subsystem functionality, (b) handles work assigned by the Facade object, and (c) keeps no reference to the facade. (这类(a)实现子系统功能,(b)通过外观对象分配处理工作,并(c)。保持没有到外观的引用) SubsystemClass6 This class (a) implements subsystem functionality, (b) handles work assigned by the Facade object, and (c) keeps no reference to the facade. (这类(a)实现子系统功能,(b)通过外观对象分配处理工作,并(c)。保持没有到外观的引用) SubsystemCl...
发布于 5 years ago
25827