avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: Difference between Configurable and Parameterizable
Date Wed, 19 Sep 2001 10:23:00 GMT
On Wed, 19 Sep 2001 18:28, Jeremias Maerki wrote:
> Hi there
>
> After looking through the documentation and the mailing list archives I
> still don't know why there are two interfaces Configurable and
> Parameterizable. I've seen some mails from April when Parameterizable
> was introduced, but that didn't help. Also, the API docs simply state
> that the two interfaces are incompatible. I currently believe
> Parameterizable isn't needed, because I can do all
> configuration/parameterization I need using Configurable.
>
> Would someone be so kind as to explain to me the differences and relieve
> me of my confusion? Many thanks in advance.

Well they really serve different purposes. Parameters supply "flat" 
configuration data and can be considered to be like simplified  
property files with extra type safe utility methods.

Configuration objects supply "hierarchial" configuration data and can be 
considered as simplified XML style configurations with extra type-safe 
utility methods.

In most cases, Configuration is acceptable but there is cases where 
Parameters are a better choice to configure the system (usually when the 
configuration data is naturally flat). For instance I quite often use 
Parameters to represent config data passed in via Command Line arguments. 

I also use it to contain names of classes implementing an interface. So say 
if I had pluggable components in my application that implemented interfaces 

com.biz.A, com.biz.B and com.biz.C

then it is useful to have Parameter object map them to implementation 
instances. ie

com.biz.A=com.biz.AImpl
com.biz.B=com.biz.BImpl
com.biz.C=com.biz.CImpl

And if I want to change the implementing class I just change a swith on CLI 
or in proeprties file and voila. In these cases XML-style config data is 
often clumsy and heavy-weight.

Does that make any sense ? ;)

-- 
Cheers,

Pete

-----------------------------------------------------------
 "Remember, your body is a temple; however, it's also your 
 dancehall and bowling alley"   -- Dharma Montgomery
-----------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message