Re: General Question about Config Files and IoC

Leo Simons <[email protected]> Wed, 18 Feb 2004 12:54:06 +0100
Newsgroups gmane.comp.java.jcontainer.interest
Message-ID <[email protected]>
peter-4lf8KW9E9MLMqX/[email protected] wrote:
>>>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.

I think a big reason to use interfaces here is that JDK 1.3+ proxying 
works only for interfaces. So if you would want to use proxy-based 
aspecting or something similar of the config object you would need to 
use an interface.

Other kinds of "magic" don't seem to care that much whether fed 
interfaces or concrete classes :D

Other than that, I tend to agree. For "pure" and strongly typed data, I 
don't use interfaces. It's more typing.

-- 
cheers,

- Leo Simons

-----------------------------------------------------------------------
Weblog              -- http://leosimons.com/
IoC Component Glue  -- http://jicarilla.org/
Articles & Opinions -- http://articles.leosimons.com/
-----------------------------------------------------------------------
"We started off trying to set up a small anarchist community, but
  people wouldn't obey the rules."
                                                         -- Alan Bennett