As an alternative of utilizing singletons, I made one class to carry an occasion for each element. Let’s name it
MainApp is initialized within the entry level of this system and determines the lifetime of all elements and assets. It has a single duty and that’s being a set of elements. That is why it did not really feel like a foul thought first.
Nonetheless, some elements want entry to different elements, there’s one element that’s wanted for nearly all different elements.
To resolve this I used dependency injection, however this makes these elements depending on
It looks like
MainApp simply grew to become an enormous mediator class for all elements.
Again to my query: Is this sort of class unhealthy design?
What could be higher options?
Or is not this class essentially unhealthy design, is the issue extra associated to the truth that loads will depend on it?