Re: General Question about Config Files and IoC
peter-4lf8KW9E9MLMqX/[email protected] Wed, 18 Feb 2004 13:04:59 +1100
| Newsgroups | gmane.comp.java.jcontainer.interest |
|---|---|
| Message-ID | <005401c3f5c3$9cef1d50$21e7809d@fisg2> |
Hi, > I am inclined to use interfaces rather than this approach. In strict > constructor-based dependency injection, using these Builders seems to be > more complex for no gain. I try not to let frameworks interefere with writing good code because every framework seems to have a slightly different approach. So I try to look at what would be easiest without a framework and then what I need to do to get the code to work in a framework secondly. > - If you create a component that uses several other components, your > configuration class can implement the configuration interfaces of each > of your dependencies. Too much chance of collisions. Many of my "configuration" objects would have parameters such as "hostname" or "port" and yet each different component would usually have different values for these fields. > - An intriguing one that's been in the back of my mind: a container > programmer who likes magic (not Leo) :) could transparently manufacture > configuration classes using XML config files, JMX, or who knows what. > Iirc, standing in for concrete classes is harder than interfaces with > the libraries people are currently using; maybe someone more experienced > than I can jump in. There is a fair number of libraries that will map datasources (XML, properties, ldap, jmx, whatever) into beans aswell. So I do not think that using interfaces and beans in this situation is any different. > - An interface feels more elegant to me... I tried to write this one > more convincingly, but I think it's just an aesthetic thing. :) :)