Dear Java Experts,
I'm looking for general guidance on designing the "startup" in Java projects which include inherited constructors. It would be great if anyone could point me to a good tutorial on this subject. Of course, if you'd like to respond directly, I'd like that, too.
My project has a single entry point (StartUp.class). Recently, I've instantiated a number of other classes within StartUp's constructor. Many of those classes also instantiate other classes, and also Super() their own superclasses.
At first, I was running into problems because I needed certain classes to instantiate in a particular order during the "bootstrap" process. For instance, I first needed the class that finds the project's home directory. Next, I needed the class that constructs the names of certain files from that...
To solve the immediate problem, I ordered the instantiation of classes in StartUp's constructor to match what I wanted, and carefully investigated THEIR startups... However, this doesn't seem to be a very clean solution. It's still difficult to follow the initial flow of control.
We normally like to think of OOP classes as more or less independent units. But how can we best work with "bootstrap" processes, in which certain classes must instantiate in particular orders?
And advice or links (or books) would be greatly appreciated.