Does the Mediator pattern eliminate coupling between objects, or does it just move it somewhere else?
It concentrates coupling rather than eliminating it. All the complexity that used to be spread thin across many objects' direct references to each other now sits inside one mediator class, which has to know about, and coordinate, every participant. This is a genuinely worthwhile trade in most cases — many small, tangled dependencies become one well-understood, centralized one — but it is not free: a mediator that keeps absorbing more responsibilities, such as routing, logging, and moderation, without discipline can grow into its own unwieldy god object. The fix when that happens is not to abandon the mediator, but to split those responsibilities into smaller collaborating classes that the mediator coordinates rather than implements directly.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response