[jdom-interest] Re: Fast or Safe?

Gerardo Horvilleur mago at mail.internet.com.mx
Thu Aug 31 16:48:07 PDT 2000

Jason Hunter wrote:
> Implementing isn't all that hard.  The big question is, are we OK with
> every add (even when initially building the document with SAXBuilder)
> doing this sanity check?
> We have a fundamental pull here (and with PCDATA checking and name
> checking and so on) between writing a fast and lightweight
> implementation that lets you do stupid things but trusts you won't, and
> writing an implementation that doesn't let you make stupid mistakes and
> will take time making sure you don't.  Each piece isn't a terrible time
> sink, but overall they'll add up.  Do we want every add to require
> multiple method calls and pointer comparisons?
> The right solution is for JDOM somehow to support both worlds.  Because
> if it doesn't, then someone (could be me) has an incentive to fork and
> write a version without all the checks that runs faster.  How to support
> both "sanity checking" and "non-sanity checking" version is the real
> trick.

Why not make Element, Document, Attribute, etc. interfaces instead of classes?

Then we could have a fast implementation of those interfaces and a safe
implementation (and maybe more: what about a thread safe implementation?) 

Gerardo Horvilleur
mago at mail.internet.com.mx

More information about the jdom-interest mailing list