You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by vinay nair <vi...@yahoo.com> on 2002/01/01 21:43:46 UTC

lifecycle management

Hi,
Have been reading the excellent artifact written by 
Berin Loritsch on "Developing with Avalon" .

A query derived from there.
(from page 32).
Why does an individual component have to be made to
write code so as  to honor a policy of lifecycle
management; which is that methods calls like
configure(),compose() ...etc has to be called ONCE and
only ONCE during components lifetime and we have to
write code to keep track of that with boolean flags
indicating whether the method was called or not.

I mean why doesn't the LifeCycleHelper class itself
keep track about the number of times the component's
lifecycle methods .
This would also remove that small mess of boolean 
flags created in each component to keep track of this
behavior.
(private boolean initialized = false;private boolean
disposed = false; etc....
)

Is this way of tracking of *valid* calls made to the
components outside the component , a poor design.?

Vinay.



__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: lifecycle management

Posted by Peter Donald <pe...@apache.org>.
On Wed, 2 Jan 2002 07:43, vinay nair wrote:
> Hi,
> Have been reading the excellent artifact written by
> Berin Loritsch on "Developing with Avalon" .
>
> A query derived from there.
> (from page 32).
> Why does an individual component have to be made to
> write code so as  to honor a policy of lifecycle
> management; which is that methods calls like
> configure(),compose() ...etc has to be called ONCE and
> only ONCE during components lifetime and we have to
> write code to keep track of that with boolean flags
> indicating whether the method was called or not.
>
> I mean why doesn't the LifeCycleHelper class itself
> keep track about the number of times the component's
> lifecycle methods .
> This would also remove that small mess of boolean
> flags created in each component to keep track of this
> behavior.
> (private boolean initialized = false;private boolean
> disposed = false; etc....
> )
>
> Is this way of tracking of *valid* calls made to the
> components outside the component , a poor design.?

I think so ;) However others disagree. Personally if I see any code like that 
in lifecycle interfaces I go through and remove it. Others like it so do what 
you are more comfortable with. 

BTW There was a thread about this not long ago on this list (I think it had 
"ComponentValidator" in the title) if you want to see some of the discussions.

-- 
Cheers,

Pete

"You know what a dumbshit the 'average man' on the street is? Well, by
definition, half of them are even dumber than that!"
					J.R. "Bob" Dobbs

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>