You are currently browsing the daily archive for October 27, 2007.

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 lets you vary heir interaction independently.

What is:
Mediator pattern

1. Source Making: mediator pattern

2. Java examples: mediator pattern in Java

Where to use & benefits

1. Partition a system into pieces or small objects.
2. Centralize control to manipulate participating objects(a.k.a colleagues)
3. Clarify the complex relationship by providing a board committee.
4. Limit subclasses.
5. Improve objects reusabilities.
6. Simplify object protocols.
7. The relationship between the control class and other participating classes is multidirectional.
8. Related patterns include
* Facade, which abstracts a subsystem to provide a more convenient interface, and its protocol is unidirectional, whereas a mediator enables cooperative behavior and its protocol is multi directional.
* Command, which is used to coordinate functionality.
* Observer, which is used in mediator pattern to enhance communication.

(Java Design Patterns At a Glance, mediator)