How can I take advantage of IObservable/IObserver to get rid of my "god object"?
- by Will
In a system I'm currently working on, I have many components which are defined as interfaces and base classes. Each part of the system has some specific points where they interact with other parts of the system.
For example, the data readying component readies some data which eventually needs to go to the data processing portion, the communications component needs to query different components for their status for relaying to the outside, etc.
Currently, I glue these parts of the system together using a "god object", or an object with intimate knowledge of different parts of the system. It registers with events over here and shuttles the results to methods over there, creates a callback method here and returns the result of that method over there, and passes many requests through a multi-threaded queue for processing because it "knows" certain actions have to run on STA threads, etc.
While its convenient, it concerns me that this one type knows so much about how everybody else in the system is designed. I'd much prefer a more generic hub that can be given instances which can expose events or methods or callbacks or that can consume these.
I've been seeing more about the IObservable/IObserver features of the reactive framework and that are being rolled into .NET 4.0 (I believe).
Can I leverage this pattern to help replace my "god object"? How should I go about doing this? Are there any resources for using this pattern for this specific purpose?