Please advise on "startup" and inherited constructors

Posted on 2005-03-15
Medium Priority
Last Modified: 2010-03-31
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.

Question by:BrianMc1958
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 92

Accepted Solution

objects earned 1000 total points
ID: 13550493
> 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?

If they are independant units, then you shouldn't need a particular order :)

So you need to either make the classes more independant, or have another class (that understands their startup dependencies) handle the stratup order.


Author Comment

ID: 13555048
Dear objects,

Thanks.  I do want to make the classes more independent.  However, in this case, some dependency will necessarily remain.  

I guesss another way to ask my question is:  Is it necessarily a sign of bad Java design that I NEED a class that understands the startup order?  Furthermore, is it strange that the startup is so heavily dependent on inherited constructors?  Should that type of thing be avoided, or does it just flow naturally from the OOP structure of Java?

Thanks one more time,

Author Comment

ID: 13576340
Dear objects,

Thanks.  I might re-formulate this question, now that I've thought about it some more.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question