Paul Hammant wrote:
Berin,

No client *should ever* call lifecycle members.  Ever.  The client is
not responsible for the lifecycle of the component, the container is.
It is a violation of contracts for that to happen.

Not quite true.

The client-code may host it's own mini component-like beans, for reasons of modularity etc. In the start() method of a real component, it is quite kosher to propogate a start() call to a bean that is in all other senses unknown to the container.

I repeat.  No *client* should ever call *lifecycle* members.  It's a
very simple contract to live by.

If the component interface requires a start() or startlike method, then
it should declare it as part of its interface.

If a component hosts other components, it becomes their container, so
when it calls lifecycle members it is not acting as a client but as
their container.

No *client* should ever call *lifecycle* members.
Only a *container* is allowed to call them.

If you need to expose a method that _looks_ like a "lifecycle" member,
I highly recommend that you make it part of the the component interface.
Then it is part of the client to component _contract_.

By having client code calling lifecycle members you are _breaking_
well defined contracts, and introducing instability in your code.
By writing your components in such a way as to require the *client*
to call a lifecycle member, you are creating room for instability.


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

Reply via email to