Skip to main content

Mediator

The Mediator design pattern defines 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 their interaction independently.

Usage     Usage     Medium-low

UML class diagram​

A visualization of the classes and objects participating in this pattern.

diagram

Sample code​

This structural code demonstrates the Mediator pattern facilitating loosely coupled communication between different objects and object types. The mediator is a central hub through which all interaction must take place.

Output​

See also​

​