avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: Defensive Component Question
Date Mon, 21 Jan 2002 13:41:18 GMT
Peter Donald wrote:

> On Sat, 19 Jan 2002 01:00, Berin Loritsch wrote:
> 
>>It's a question of what do you make smart, and what are the tradeoffs.
>>Naturally, there is a slight performance hit when you place checking logic
>>in the component itself (very slight).  The ComponentValidator class can
>>be used in either the Container or the Component (or both), and helps
>>newcomers learn the system better with fail-quick messages and helpful
>>exceptions.
>>
>>
>>>What is the coding standard for Avalon code? Are cases like this
>>>considered a problem in the Avalon class? Or are they only required to
>>>not throw NullPointerExceptions etc if the contacts are followed exactly?
>>>
>>If any exception is thrown during the initialization of a Component, that
>>Component is no longer valid.  If a valid component ever throws an
>>exception that is not part of the contract of the Component (like a
>>NullPointerException), then the Component is broken.
>>
> 
> I wouldn't say that. There are some exceptions like InvalidStateException 
> that can effectively indicate "hey you are using me poorly" - especially when 
> the component have no fixed container.


And hence, because the usage contracts have been violated, the Container can
no longer guarantee it is in a consistent state, therefore it is no longer
valid.




-- 

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


--
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