MΓ³dulo 23 Β· Design Patterns (All 23 GoF) β LecciΓ³n 17 de 23 Β· ~6 min
Mediator
Mediator: a hub that coordinates peers
Problem: many objects need to talk to each other. Wire them directly and you get an N-to-N tangle where everyone references everyone.
PawWalk scenario: a dispatch center. Walker, owner, and tracker don't hold references to each other β they notify the mediator, which routes to the others.
The mediator centralizes the 'who tells whom' logic so the peers stay decoupled.