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


as implementing "loosely-coupled" approach messaging using prism's eventaggregator, came across interesting scenario: class had no public interface; of it's input , output done via these behind-the-scenes pub/sub events. if reuse class in project, @ public interface see functionality offers , dependencies are. in case there nothing (except event aggregator service). have inside class see events subscribing to, , events publishes in order know how fits surroundings... otherwise sits there , nothing.

is drawback pub/sub pattern--lack of discover-ability?

interfaces hide implementation details , that's why use them, @ same time create coupling between components.

pub/sub pattern tries eliminate coupling, there no way can use form of interface. yes, it's drawback.

also, in case if want reuse logic pub/sub , other consumers using interfaces can extract common methods interface , call methods private pub/sub listeners.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -