In the system I'm currently working on, I have many components that are defined as interfaces and base classes. Each part of the system has certain points where they interact with other parts of the system.
For example, a data preparation component prepares some data, which ultimately must go into the data processing part, a communication component needs to request different components for their status for relaying to an external one, etc.
I am currently gluing these parts of the system using an “object-god,” or an object with deep knowledge of the various parts of the system. It registers with events here and transfers the results to methods there, creates a callback method here and returns the result of this method there and passes many requests through a multi-threaded queue for processing, because it “knows” certain actions to run on STA streams, etc.
While this is convenient, it concerns me that this type knows so much about how everyone else in the system is designed. I would prefer a more general hub that can be provided with instances that can expose events or methods or callbacks or that can use them.
I saw more about the IObservable / IObserver features in a reactive environment and which are currently loading in .NET 4.0 (I suppose).
Can I use this template to replace my “god object”? How can I do it? Are there any resources to use this template for this particular purpose?
source share