Mediator


Usage

  • Defines simplified communication between classes
  • Defines an object that encapsulates how a set of objects interact
  • Promotes loose coupling by keeping objects from referring to each other explicitly
  • Varies their interaction independently

Diagram

Mediator

Participants

Mediator
  • Defines an interface for communicating with Colleague objects
ConcreteMediator
  • Implements cooperative behavior by coordinating Colleague objects
  • Knows and maintains its colleagues
Colleague classes
  • Each Colleague class knows its Mediator object
  • Each colleague communicates with its mediator whenever it would have otherwise communicated with another colleague
Resources URL: 
notes/design_patterns/resources
Sources URL: 
notes/design_patterns/sources

See Also