Module 27 ยท Design Patterns (All 23 GoF) โ Lesson 17 of 23 ยท ~6 min
Mediator
A hub so peers don't reference each other
Mediator centralizes communication in one object so participants talk to the hub, not to each other. A dispatch center coordinates the walker, the owner, and the GPS tracker: when one raises an event, the mediator decides who else hears it. The peers stay decoupled.
Without a mediator, every participant holds references to every other โ an n-to-n tangle. With one, it's n-to-hub.