avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gonzalo Diethelm" <gonzalo.dieth...@aditiva.com>
Subject Basic questions
Date Fri, 10 May 2002 03:13:56 GMT
Hello,

I  have  been doing  some  reading on  Framework  and components,
trying to understand the   basic concepts  behind their   design.
I  have  some  honest  questions,  not  intended to  express  any
opinion on anything at all, just looking for answers.  In fact, I
think I know the answers to some of the questions, but I'm asking
them anyway to check my understanding.

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?

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?

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?


The  second  scenario  is  running  this  business  logic  from a
servlet-based  application.   Under   this  scenario,  the   user
interface  is handled  with Struts;  the user  enters some  data,
clicks on  a button,  and a  Struts Action  class is reached.  At
this point, the Action class grabs the entered data and is  ready
to call the business logic component.

4. Is there any benefit in using a ComponentManager here?   After
all, the  Action class  could simply  create an  instance of Foo,
pass the parameters and grab the result, right?

5. My understanding is  that the ComponentManager at  least would
be helpful in providing some  kind of pooling of components.   If
this is the case, would the ComponentManager be a Singleton?   If
yes, who instantiates it?  Who ensures it really IS a singleton?


The Struts scenario is more  than just an hypothetic example;  it
is EXACTLY  the way  we plan  to build  our applications.  So, my
last questions are:

6.  Anybody  is  using Struts  +  Framework?   Can anybody  share
comments, hints, caveats, etc.?  For example, can you use  LogKit
on the Struts Action classes and on the Components, and have  all
output treated uniformly?  Or does Struts REQUIRE using log4j?

7. Anybody  can provide  a real  working example  of the Struts +
Framework combination?

Sorry if  the questions  seem basic  or confused,  and thanks  in
advance for any help.


--
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com

--

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message