Skip to content
StackDecode
System Design
15. Software Design PatternsAnimated walkthrough

Mediator Pattern

Objects talk through a mediator, not directly.

The idea

The mediator coordinates communication, reducing tangled dependencies.

Watch it work

The steps light up one at a time. Use the controls to pause or step through.

  1. 1Components register with the mediator
  2. 2One sends a message
  3. 3The mediator routes it
  4. 4Others react
1/4

Step by step

  1. 1Components register with the mediator
  2. 2One sends a message
  3. 3The mediator routes it
  4. 4Others react

Where it is used

Chat rooms and UI dialogs.

Watch out for

The mediator can become a god object.

Related