|
Anonymous Collaboration
|
Two or more parts using each other without knowing about each other.
For example, if PartA wants PartB to do something, PartA can send a Message to a MessageRouter, which sends it to PartB. This is one style of Anonymous Collaboration. It greatly reduces part dependencies.
Let's consider the matter in more detail. First off, Anonymous Collaboration yields looser coupling than the standard event object and listener interface, aka Event Listener Pattern. This is because the listener is usually the final event recipient. The event source knows who all its listeners are. Something has to hookup all these listeners to the event source. This is medium tight coupling.
By contrast Anonymous Collaboration uses things like a Message and MessageRouter. The event source knows only about the router, who plays the role of Mediator. That's all that needs to be hooked up to add the event source to the system graph. There are also event recipients listening to the router for specific event types. Think of it as a Tinker to Evers to Chance ball play.
Thus objects emit events instead of calling methods directly on other objects, and they emit a generic event to the same router every time. Where that event goes is totally beyond the fathomability of the event source, as it should be to achieve loose coupling.
![]() |
Use this to help achieve the ultimate in loose coupling. |