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.
- 1Components register with the mediator
- 2One sends a message
- 3The mediator routes it
- 4Others react
1/4
Step by step
- 1Components register with the mediator
- 2One sends a message
- 3The mediator routes it
- 4Others react
Where it is used
Chat rooms and UI dialogs.
Watch out for
The mediator can become a god object.