cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: [RT] Concerns surrounding CocoonNG
Date Wed, 11 Aug 2004 04:31:15 GMT
On Wednesday 11 August 2004 04:22, Sylvain Wallez wrote:

> Although this is very good from a robustness point of view, I don't feel
> at ease with this as it requires to somehow manage dependencies twice:
> in the model where they have to be formally expressed, and in the code
> where actual lookup occurs. Again, depencency injection (as opposed to
> lookup) avoids this problem.

Looking at the actual differences;

public AbcComponent( org.hedhman.niclas.SomeDependency some )
{
    m_SomeDependency = some;
}

/** @avalon.dependency type="org.hedhman.niclas.SomeDependency" 
*      key = "some"
*/
public void service(ServiceManager man )
{
    m_SomeDependency = (SomeDependency) man.lookup( "some" );
}

If there is proper SoII in CDI, the SomeDependency is an interface, and that 
leaves room for more than one implementation, in which case both Merlin and 
Pico/Nano needs additional meta/code to declare exactly which implementation 
to be used.

If there is only one implementation available, Merlin will use that only, as I 
believe Pico/Nano will also figure out.

So, the current differences are not as great as some may think. Merlin has 
come a long way compared to ECM, but I agree that there are room for further 
improvements.

> You said that Merlin is going to support injection, which IMO a very
> good thing. 

We have taken a few steps in that direction already. So called "custom 
contexts" can already be injected via constructors, as can the traditional 
Avalon lifecycle objects, such as Logger, Context, ServiceManager, 
Configuration and Parameters.

The next step ain't that far away, we are just struggling with some semantics, 
especially surrounding the possibility of more than a single constructor, 
which Pico says is a no-no, but could be a necessity.
Another 'issue' that CDI imposes is how to deal with aggregations and possibly 
custom configuration/parameterization objects, which Pico (unlike Type2) will 
need.

All and all, I am fairly positive about the continuation of the Merlin 
convergence with other IoC styles, especially if Merlin becomes the Metro 
TLP, in which case there no longer exist any 'religious reasons' to stick 
with the Avalon-way only.


Cheers
Niclas
-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


Mime
View raw message