How to do manual DI with deep object graphs and many dependencies properly
- by Fabian
I believe this questions has been asked in some or the other way but i'm not getting it yet.
We do a GWT project and my project leader disallowed to use GIN/Guice as an DI framework (new programmers are not going to understand it, he argued) so I try to do the DI manually.
Now I have a problem with deep object graphs. The object hierarchy from the UI looks like this:
AppPresenter-DashboardPresenter-GadgetPresenter-GadgetConfigPresenter
The GadgetConfigPresenter way down the object hierarchy tree has a few dependencies like CustomerRepository, ProjectRepository, MandatorRepository, etc.
So the GadgetPresenter which creates the GadgetConfigPresenter also has these dependencies and so on, up to the entry point of the app which creates the AppPresenter.
Is this the way manual DI is supposed to work?
doesn't this mean that I create all dependencies at boot time even I don't need them?
would a DI framework like GIN/Guice help me here?