`

head first design pattern 各个模式的定义

阅读更多
看完 head first以后,为了避免以后对一些模式记忆模糊之后还要再去翻书。网上查了下,没有查到有人讲所有模式的定义列出来。这个体力活只好我干了。。真是花了不少时间啊。。。
----------------------------------------------------------------------------------------
模式:是在某种情境下,针对某问题的某种解决方案。

A pattern is a solution to a problem in a context.

----------------------------------------------------------------------------------------

策略模式:定义了算法簇,分别封装起来,让它们之间可以相互替换,此模式让算法的变化独立于使用算法的客户。

The Strategy Pattern:defines a family of algorithms,encapsulates each one,and makes them interchangeable.Strategy lets the algorithm vary independently from clients that use it.
----------------------------------------------------------------------------------------
观察者模式:定义了对象之间的一对多依赖,这样一来,当一个对象改变状态时,它的所有依赖者都会收到通知并自动更新。

The Observer Pattern:define a one-to-many dependency between objects so that when one object changes state,all of its dependency are notyfied and updated automatically.

----------------------------------------------------------------------------------------
装饰者模式:动态地将责任附加到对象上。若要扩展功能,装饰者提供了比继承更有弹性的替代方案。

The Decorator Pattern:attaches additional responsibilitis to an object dynamically.Decorator provide a flexible alternative to subclassing for extending functionality.
----------------------------------------------------------------------------------------
工厂方法模式:定义了一个创建对象的接口,但由子类决定要实例化的类是哪一个。工厂方法让类把实例化推迟到子类。

The Factory Method patern:defines an interface for creating an object,but lets subclasses decide which class to instantiate.Factory Method lets a class defer instantiation to subclass.

----------------------------------------------------------------------------------------
单例模式:确保一个类只有一个实例,并提供一个全局访问点。

The Singleton Pattern:ensures a class has only on instance,and provides a global point of access to it.
----------------------------------------------------------------------------------------
命令模式:将“请求”封装成对象,以便使用不同的请求队列或者日志来参数化其他对象。命令模式也支持可撤销的操作。

The Command Pattern:encapsulates a request as an object,thereby letting you parameterize other objects with different requests,queue or log requests,and support undoable operations.

----------------------------------------------------------------------------------------
适配器模式:将一个类的接口,转换成客户期望的另一个接口。适配器让原本接口不兼容的类可以合作无间。

The Adapter Patter:converts the interface of a class into anohter interface the clients expects.Adapter lets classes work together that couldn't ohterwise because of incompatible interfaces.
----------------------------------------------------------------------------------------
外观模式:提供了一个统一的接口,用来访问子系统中的一群接口。外观定义了一个高层接口,让子系统更容易使用。

The Facade pattern:provides a unified interface to a set of interfaces in a subsystem.Facade defines a higher-level interface that makes the subsystem easier to use.

----------------------------------------------------------------------------------------
模板方法模式:在一个方法中定义一个算法的骨架,而将一些步骤延迟到子类中。模板方法使得子类可以在不改变算法结构的情况下,重新定义算法中的某些步骤。

The Template Method Pattern:defines the skeleton of an algorithm in a method ,deferring some steps to subclass.Template Method lets subclass redefine certain steps of an algorithm without changing the algorithm's structure.
----------------------------------------------------------------------------------------
迭代器模式:提供一种方法顺序访问一个聚合对象中的各个元素,而又不暴露其内部的表示。

The Iterator Pattern:provides a way to access the elements of an aggregate object sequentially without exposing its underying representation.

----------------------------------------------------------------------------------------
组合模式:允许你将对象组合成树形结构来表现“整体/部分”层次结构。组合能让客户以一致的方式处理个别对象以及对象组合。

The Composite Pattern:allows you to compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treats individual objects and compositions of objects uniformly.
----------------------------------------------------------------------------------------
状态模式:允许对象在内部状态改变时改变它的行为,对象看起来像修改了它的类。

The State Pattern:allows an object to alter its behavior when its internal state changes.The Object will apear to changes its class.

----------------------------------------------------------------------------------------
代理模式:为另一个对象提供一个替身或占位符以控制这个对象的访问。

The Proxy Pattern:provides a surrogate or placeholder for another object to control access to it.
2
2
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics