随笔分类 -  Design Pattern

设计模式系列7-----C++实现访问者模式(Visitor Pattern)
摘要:什么是访问者模式? Definition:Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which... 阅读全文

posted @ 2011-12-11 00:38 GraphicsMe 阅读(3262) 评论(0) 推荐(0)

设计模式系列6-----C++实现状态模式(State Pattern)
摘要:什么是状态模式? Definition: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. 当对象有几种状态时,不同状态时有不同的表现,为了避免复杂的ifelse逻辑,将每个状态的逻辑单独封装... 阅读全文

posted @ 2011-12-09 19:52 GraphicsMe 阅读(1205) 评论(0) 推荐(0)

设计模式系列5-----C++实现中介者模式(Mediator Pattern)
摘要:什么是中介者模式? Mediator Pattern Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it ... 阅读全文

posted @ 2011-12-08 22:18 GraphicsMe 阅读(424) 评论(0) 推荐(0)

设计模式系列4-----C++实现备忘录模式(Memento Pattern)
摘要:什么是备忘录模式? Without violating encapsulation, capture and externalize an object’s internal state so that the object can be returned to this state later. 其实‘人’如其名,备忘模式就是为了对一个对象做备忘,允许做类似“重播”、... 阅读全文

posted @ 2011-12-07 20:31 GraphicsMe 阅读(506) 评论(0) 推荐(0)

设计模式系列3-----C++实现命令模式(Command Pattern)
摘要:什么是命令模式? GoF的书的定义为:“Command pattern encapsulate request as an object, thereby letting you parameterize clients with different request, queue or log request, and support undoable operations” 换言之,讲命令封... 阅读全文

posted @ 2011-12-06 23:32 GraphicsMe 阅读(611) 评论(0) 推荐(0)

设计模式系列2-----C++实现责任链模式(Chain of Responsibility)
摘要:什么是责任链模式? wikipedia的定义为:CoR pattern consists of a source of command objects and a series of processing objects. Each processing object contains a set of logic that describes the types of comman... 阅读全文

posted @ 2011-12-04 17:15 GraphicsMe 阅读(623) 评论(0) 推荐(0)

设计模式系列1-----C++实现策略模式(Strategy)
摘要:什么是策略模式? wikipedia的定义为: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.... 阅读全文

posted @ 2011-12-03 20:04 GraphicsMe 阅读(1100) 评论(0) 推荐(0)

导航