cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: [RT] Access to the object model
Date Wed, 21 May 2003 09:28:26 GMT
Carsten Ziegeler wrote:

>Sylvain Wallez wrote:
>  
>
>>>>I even find it cleaner than having to pass the object model as 
>>>>        
>>>>
>>a parameter down to components that need it, eventually having to 
>>pass it through components that absolutely don't care about it. 
>>And if the call chain goes through components that don't allow 
>>the transmission of the object model, then you're stuck to the 
>>ugly CocoonComponentManager.getCurrentEnvironment().getObjectModel().
>>    
>>
>>>>   
>>>>
>>>>        
>>>>
>>>Yes, and this is exactly one of my points, adding the object 
>>>      
>>>
>>model to the signature of a component doesn't make sense. On the 
>>other hand, you need the object model in some implementations.
>>    
>>
>>>I think a simple ObjectModelHelper.getObjectModel() would do the 
>>>      
>>>
>>trick for now :)
>>    
>>
>>>(Let the flame war start...)
>>>
>>>      
>>>
>>Ermh... is it really cleaner than the CocoonComponentManager hack ?
>>    
>>
>Yes, it's an official api :-)
>
>  
>
>>If we are to officially generalize access to the object model, I'd like it to be done
in a clean way, and using the Context seems better to me.
>>    
>>
>I totally agree with you and actually I wanted to provocate a reaction or answer why the
static method is really that bad.
>

Because static methods give the feeling of some global variable, even if 
a ThreadLocal actually hides behind it.

>Now, I know, IoC is great and I have the *feeling* that the static approach is not good,
but I don't have a real reason other than saying: "It's not IoC".
>

Mmmh... yes, it's not IoC. I don't have anything else but bad feelings 
about static methods for now, but I'm wondering how this will fit with 
blocks : the strong separation between blocks may lead us to want 
different environments between different blocks, and having a single 
static entry point may make it difficult to implement cleanly this 
separation, while - each block having its own container - going through 
the Context will make it trivial and controlled.

>I personally would like to have both ways: using the context (=IoC) and also the static
way for places where IoC is not possible.
>  
>

Ah, so next problem : where isn't IoC possible ?

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Mime
View raw message