This is my first post, and describing this question is difficult for me.
I believe I fully understand the Mediator Pattern. My question is more on a technicality.
I have a Mediator and 3 Colleagues (C1-3).
The Mediator sends and gets back messages to/from C1. It sends and gets back messages to/from C2 as well. But with C3, it only sends one message, and does not receive any messages.
C1 and C2 are very obviously colleagues. But from a [Java] coding perspective, C3 does not have to be a Colleague. It never calls back to the mediator, so it never uses the mediator field. That's the only thing that inheritance would give it, so giving it is in a way pointless.
But on the other hand, the Mediator does use C3, so do we make it a Colleague to make that clear?
I wonder if there is a technical answer to this question or if this is just a matter of opinion.
Aucun commentaire:
Enregistrer un commentaire