[jdom-interest] Request -- please allow all XML 1.1 conformant text in Element.se tText()

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Mar 6 05:20:33 PST 2004


At 11:35 PM +1100 3/6/04, Chris B. wrote:

>Data validity should be handled by assertions. It's not for you to 
>decide if the user of JDOM wants to guarantee to pass in valid data 
>and doesn't want checking overhead. Go read Object Oriented Software 
>Construction by Bertrand Meyer.

I have. Have you? Java assertions do not meet Meyer's design by 
contract criteria. More importantly Meyer allows only one reason for 
turning off precondition checking, performance. (A point on which I 
disagree with him.) He does not believe clients should be able to 
turn off preconditions in order to change the semantics of a class as 
is being requested here.

>BTW, private members are evil. Everything should be protected. It's 
>not up to you to decide how somebody may want to extend your object.

Actually it is. As Joshua Bloch wrote, design for subclassing or 
prohibit it. JDOM's had a lot of problems over the years because we 
failed to follow this rule rigorously. The protected API is no less 
of a promise to clients than the public API. Indeed allowing 
subclasses to change too much violates the promises made in the 
public API.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the jdom-interest mailing list