设计模式:行为型-中介模式
Mediator pattern defines a separate (mediator) object that encapsulates the interaction between a set of objects and the objects delegate their interaction to a mediator object instead of interacting with each other directly.
设计模式:行为型-解释器模式
Interpreter pattern is used to defines a grammatical representation for a language and provides an interpreter to deal with this grammar.
设计模式:行为型-命令模式
The command pattern encapsulates a request as an object, thereby letting us parameterize other objects with different requests, queue or log requests, and support undoable operations.
设计模式:行为型-备忘录模式
Captures and externalizes an object’s internal state so that it can be restored later, all without violating encapsulation.
设计模式:行为型-访问者模式
Allows for one or more operation to be applied to a set of objects at runtime, decoupling the operations from the object structure.
设计模式:行为型-迭代器模式
迭代器模式(Iterator Design Pattern),也叫作游标模式(Cursor Design Pattern)。
迭代器模式将集合对象的遍历操作从集合类中拆分出来,放到迭代器类中,让两者的职责更加单一。
设计模式:行为型-职责链模式
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
设计模式:行为型-策略模式
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
设计模式:行为型-模板模式
模板模式主要是用来解决复用和扩展两个问题,结合 Java Servlet、JUnit TestCase、Java InputStream、Java AbstractList 四个例子来具体讲解这两个作用。
设计模式:行为型-观察者模式
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.