Jonathan Hawkes wrote:

In the current specification, it is fairly straightforward to implement an
Avalon container.  When would you suggest the container poll this new
isRunning method?  It would be preferable to have the component notify the
container if it shut itself down.  However, then you run the risk of
perverting IOC.

Not necessarily. As an example, I will use Swing components. Each Swing component has a number of listeners available for it. The Swing component doesn't know or care what objects are listening, all it does is send events to the listener.

Therefore, if the component has an add/remove RuntimeListener or some such
animal, the container could register itself as a listener and receive a
RuntimeEvent for each change in state.  Alternatively, it might register a
controlled part of itself for that purpose.

The thing is that the IOC is not inverted, and proper separation is still
maintained.

It works, but the whole Listener maintenance code can be a PITA to force
component writers to implement.  For that purpose an Abstract Class would
be helpful.

--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


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



Reply via email to