Gonzalo,

>Say I write a class with some kind of business logic:
>
>  class Foo { public String getAnswer(String data) { ... } }
>
>The class would in principle benefit with some of the life  cycle
>abstractions in  Framework.  For  example, the  class could  need
>some kind of configuration and  logging, so it could be  declared
>as: 
>
>  class Foo implements LogEnabled, Configurable { ... }
>
>Now, I  start by  testing this  class from  a simple command line
>program.  At  this point:
>
>1. Do I  gain  anything by  having Foo  implement  LogEnabled and
>Configurable?
>  
>
Not from the point of view of testing. .....

>2. Who  will call  the proper  configure()  method  in the class?
>Does the  class  have to be  put into a  component manager?  This
>seems to me to be the case, and if this is so, then it is kind of
>useless to have a component "living by itself", not as part of  a
>component manager.  Is this correct?
>  
>
But it is not so hard for a Unit Test to Fake a container.  Even if you 
'test' is a home grown mainable class, the lifecycle methods
can still be activated. Granted configure(..) is harder than 
enableLogging(..) but there once made, the reusability is high.

There is an 'ObjectMother' pattern that makes test setup easier.

>3. If the "component by  itself" does indeed not make  sense: the
>docos talk about running components as stand-alone programs (such
>as my test case).  In this case, the test program is  responsible
>for taking the component through the life cycle, right?  In  this
>case, and supposing  the component will  ONLY be run  from a test
>program,  is  there any  value  at all  in  making this  class  a
>component and having it implement Configurable?  I mean,  someone
>will have to call the configure() method anyway; why not have the
>component call it itself when appropriate?
>
IoC pattern on avvalon-framework website.

I'll not answer you other questions, as the Cocoon guys can do so with 
more authority.  Good newbie stuff though.

-ph


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to