| id |
behavioral/mediator |
| name |
Mediator |
| aliases |
|
| guide_url |
|
| problem |
Stop a web of objects from referencing each other by routing their interactions through one coordinator. |
| symptoms |
widgets updating each other |
N-squared object references |
form fields with interdependent rules |
components need decoupling |
|
| verdict |
use-with-care |
| caveats |
The mediator earns its keep by deleting pairwise references; if it grows into a god object that knows everything, you traded a web for a blob. |
For pipeline-shaped decoupling, a queue between producers and consumers is the simpler mediator. |
|
| stdlib_sightings |
queue.Queue |
asyncio.Queue |
|
Route component interactions through one coordinator that owns every rule.
Verdict: use with care — excellent for genuinely tangled rules; watch
for god-object drift.
uv run python -m patterns.behavioral.mediator.examples.checkout_form.main