Mediator Pattern

The Mediator pattern simplifies communication among objects in a system by introducing a single object that manages message distribution among other objects. The Mediator pattern promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. 

UML representation


The following lists the benefits of using the Mediator pattern:
  • Decouples colleagues
  • Simplifies object protocols
  • Centralizes control

When to Use

You should use the Mediator pattern when:
  • A set of objects communicate in well-defined but complex ways.
  • You want to customize a behavior that’s distributed between several objects without using subclasses.
Subpages (1): Mediator Pattern Example