OK, slow down. Take a deep breath. 

Now forget everything you know about "dependency injection". 

We are not doing dependency injection here. These are *stateful* components 
with *identity*. Think about Seam in terms of "contextual variables". 

@In and @Out alias contextual variables to instance variables. By analogy with 
aliasing instance variables to local variables:

    @In Foo foo;

Is similar to:

    final Foo foo = this.foo;
    ...

And:

     @In @Out Foo foo;

is like:

     Foo foo = this.foo;
     ...
     this.foo = foo;

The difference with @In @Out is that you are able to modify the value of the 
variable itself. ie. change the reference. With @In alone, you can only change 
the state of the referent.

With stateful components you sometimes simply can't "do everything with 
side-effects". For example:

     currentUser = entityManager.merge(currentUser);

As for uniqueness, the whole *idea* of contextual components is that I have a 
unique instance of any particular component in "my current XXXXX context". 
Substitute EVENT, REQUEST, SESSION, CONVERSATION, PROCESS, APPLICATION or PAGE 
for XXXXX.

Think about "state", "context" and "identity" and how they relate to each 
other. These concepts are key to understanding anything in Seam. Seam 
components are true "objects" with state+behavior+identity. Stateless component 
models are by nature *not* object-oriented.

It seems that too much experience of Spring and similar stateless component 
models has addled everybody's brains even worse that I feared! ;-)


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914884#3914884

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914884


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to