Mediator
AKA: Director
When a set of objects react to each other’s state changes, the interactions can become complex. The objects involved become coupled to their specific use case and their relationships with the other objects. The objects may have had to derive from the regular objects to handle the need to send updates to their colleagues in the larger solution while avoiding cascading recursive calls.
A mediator or director object coordinates behaviour when specialising other objects is impossible or not desired. It reduces the need to write specific update code targeting specific objects, increasing the reusability of the interacting components because they no longer need role-specific customisation.
When an object would otherwise have had to inform a neighbouring object about
its change, A mediator listens for changes in objects from generic endpoints.
It can use
“Let me coordinate this whole thing.”