cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@apache.org>
Subject Re: [RT] Simplifying component handling
Date Sat, 31 Dec 2005 00:56:07 GMT

On 30.12.2005, at 20:21, Vadim Gritsenko wrote:

> Carsten Ziegeler wrote:
>> Gianugo Rabellino wrote:
>>> I'm definitely not a fan of constructor injection, exp. when we
>>> consider how (way too) often we resorted to inheritance in Cocoon
>>> components. Now, while interface injection is clearly out of  
>>> fashion,
>>> sticking with Avalon/Excalibur also means that it would be difficult
>>> to get around the container (e.g., how do you release components  
>>> with
>>> your approach? I assume Excalibur still kinda needs that).
>>
>> Yes, Excalibur still needs it - but it's easy. Bascially, you  
>> "emulate"
>> the service() method on construction of the object and then you
>> "emulate" the dispose method when destroying the object.  
>> Everything our
>> ecm++ needs to know is there. As I said, I've done this in  
>> Fortress and
>> we can use that code in ecm++ as well.
>> And we could implement setter injection with some kind of auto  
>> wiring as
>> well. It's not really that harder. But using setters again  
>> requires to
>> code more than using a constructor.
>
> I'm with Gianugo on this one - I'd better have setter injection  
> instead of constructor injection.

Maybe this is becoming a bit OT but could you guys give some reasons  
why?

I personally prefer contructor injection over setter injection  
because of
the clear contract. As soon as the object is instantiated it can be  
used.

With setter injection you have to have some weird behind the scenes  
object
life-cycle.

cheers
--
Torsten


Mime
View raw message