I'm using the Reactive framework in C# and I am curious if using an application wide observer (Singleton Message Bus) is a worthy cause? In a quarantined section of the application it works like a charm but I am curious if anyone has any wisdom that screams, "NO! WTF ARE YOU THINKING!"
Technical input as well as theoretical Pattern knowledge is more than welcome!
I used an approach like this in one of my old C/C++ applications. It has the advantage that you can decouple modules, but in my experience it quickly leads to lots of problems in bigger applications:
My conclusion is that a global message bus is a nice idea for small applications, but not for big ones. By using one global message bus to decouple all your modules, you effectively achieve the opposite, since everyone is now linked to everyone else, making it harder in the long term to untangle your application again.
I would suggest to make every module as independent as possible, and to use specialized observers (see observer pattern of the Gang Of Four).
This pattern is widely used to decrease tie-up between app components. I've used it in a few of my projects and it's really very cosy and useful. I'm talking about pattern in general, I don't know how is it implemented in Reactive framework.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.