摘要:什么是访问者模式? 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...
阅读全文
摘要:什么是状态模式? Definition: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. 当对象有几种状态时,不同状态时有不同的表现,为了避免复杂的ifelse逻辑,将每个状态的逻辑单独封装...
阅读全文
摘要:什么是中介者模式? 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 ...
阅读全文
摘要:什么是备忘录模式? Without violating encapsulation, capture and externalize an object’s internal state so that the object can be returned to this state later. 其实‘人’如其名,备忘模式就是为了对一个对象做备忘,允许做类似“重播”、...
阅读全文
摘要:什么是命令模式? GoF的书的定义为:“Command pattern encapsulate request as an object, thereby letting you parameterize clients with different request, queue or log request, and support undoable operations” 换言之,讲命令封...
阅读全文
摘要:什么是责任链模式? 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...
阅读全文
摘要:什么是策略模式? 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....
阅读全文