[jdom-interest] Interfaces? (was: W3 DOM support)

Louis Tribble louis.tribble at metamata.com
Fri Aug 4 18:16:02 PDT 2000


Alex Chaffee wrote:
> 
> On Thu, Aug 03, 2000 at 05:03:42PM -0400, Simon St.Laurent wrote:
> > At 09:23 AM 8/2/00 -0400, Scott Boag/CAM/Lotus wrote:
> > >As I've said before, I don't see why JDOM can't support a subset of the DOM
> > >APIs.
> > >
> >
> > I thought the DOM and JDOM were both APIs, ways to look in on data.  It
> > doesn't seem nearly that difficult to provide (or connect to) two APIs
> > looking in on the same information.
> >
> > I know it's more work, and maybe there are efficiency tradeoffs - I
> > wouldn't be surprised - but I don't think it has to be an either/or situation.
> 
> <snip>
> 
> The point is, making either a copy of the JDOM tree contents into a
> new DOM tree, or a set of DOM wrapper objects that point back to the
> JDOM equivalents, or a set of hybrid extends-JDOM-but-implements-DOM
> objects, are all possible and straightforward, though there may be
> performance issues.  Which is exactly Simon's point.

I've been resisting asking until I actually fleshed out my own use
cases (Swing stuff, incremental document persistence), but I can't help 
myself... If I missed an early discussion, my apologies.

Is there a reason that the public API classes (Document, Element, 
Comment, and company) are classes rather than interfaces? (The classes
would become, for example, DefaultDocument, DefaultElement,... .)

For one thing, this opens other options for Alex's list, with
probably different performance and difficulty tradeoffs: a set of
hybrid implements-JDOM-but-extends-DOM objects, or a set of 
implements-DOM-and-JDOM objects. My instinct is that interfaces are 
also better for alternate implementations of the "pure" API. The lazy 
Builder on the wish list, or an implementation that supports 
persistence and/or transactional updates, for example.

Interfaces leave more doors unlocked. Is there anything gained by
leaving them locked?

Louis
-- 

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Louis Tribble                                         louis at metamata.com
Metamata, Inc.                                   http://www.metamata.com
Tools for serious Java developers.                       +1 510 796 0915
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>



More information about the jdom-interest mailing list