Re: General Question about Config Files and IoC

peter-4lf8KW9E9MLMqX/[email protected] Wed, 18 Feb 2004 12:35:17 +1100
Newsgroups gmane.comp.java.jcontainer.interest
Message-ID <002e01c3f5bf$7691a140$21e7809d@fisg2>
> > Of course, it doesn't have to be an 'ObjectAConfig' class, it could be
> > a Properties object, a DOM document, or anything else.. but there is
> > the general principal of passing a representation of the config via
> > the constructor.
>
>
> I'd always suggest not doing a Properties or DOM object via the ctor. It
> is too vague.  An interface to represent the the configuration, with
> multiple possible implementations is my preference.

I would always opt for a concrete Configuration object with multiple
strategies for building that configuration object if needed. ie

ObjectA
ObjectAConfig
XMLObjectAConfigBuilder
DBObjectAConfigBuilder
...

That is much easier to evolve over time IMHO.