[jdom-interest] Still more Verification

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Aug 23 05:05:39 PDT 2000

At 9:43 AM +0200 8/23/00, Oliver Imbusch wrote:
>>>>>> "jh" == Jason Hunter <jhunter at collab.net> writes:

>    jh> But how would one differentiate between the two?
>public void setValue (String value, boolean check) {
>    if (check) {
>        String reason = Verifier.checkCharacterData (value);
>        if (reason != null) {
>            throw new IllegalDataException (value, reason);
>        }
>    }
>    this.value = value;

I really don't like this option. It lets programmers who don't 
understand what they're doing sacrifice program correctness in the 
name of the false god performance. In my experience, programmers are 
way too quick to make pointless optimizations and way too slow to 
make sure their code actually does what it's supposed to do. We 
should make it as hard as possible to do the wrong thing and as easy 
as possible to do the right thing.

May I ask why you turned off the verification code? What was the 
program? What performance measurements showed you that this was the 
bottleneck in your code? How much speed did you gain by disabling the 

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |

More information about the jdom-interest mailing list