mercredi 22 avril 2015

What do do when Pub/Sub Messaging eliminates a module's interface?

As I was implementing the "loosely-coupled" approach to messaging using Prism's EventAggregator, I came across an interesting scenario: a class which had no public interface; all of it's input and output was done via these behind-the-scenes pub/sub events. If I was to reuse this class in another project, I would look at the public interface to see what functionality it offers and what its dependencies are. But in this case there is nothing (except an event aggregator service). I would have to look inside the class to see what events it is subscribing to, and what events it publishes in order to know how it fits into its surroundings... otherwise it just sits there and does nothing.

Is this a drawback to the pub/sub pattern--lack of discover-ability?

Aucun commentaire:

Enregistrer un commentaire