Several objects have to be changed simultaneously however they do not form a hiararchy as in the Chain of Responsibility. If they communicate with each other, they have to keep a record of each other. A convenient way is to introduce a Mediator to loosen up their coupling.
However, now the
ConcreteMediator must keep a record of all
Collegues. Each
ConcreteCollegue inform the
Mediator by passing its pointer. The advantages of a Meditator are
- It limits subclassing of Collegues.
- It centralizes controls.
- The communication of Collegues become easier.
In reality the interface of Meditator is not indispensable.
No comments:
Post a Comment