[jdom-interest] Why not interfaces?

Paul Philion philion at acmerocket.com
Thu Sep 7 12:20:23 PDT 2000

I've added comments below, inline...

-jh- said:
> I just posted recently about the things that the
> interface/factory makes you do, as evidenced by
> what DOM does.

I missed the original. Is there somewhere I can review it online? I
don't want to rehash a discussion that has already been had.

> Think about building a "thread safe" implementation
> -- then how do you guarantee the doc remains thread
> safe?  You have to do things like use the doc as the
> factory and import nodes.  Way more pain than it's worth.
> You also lose the ability to mandate how equals() works,
> and things like that.

You mention two issues here:

1) Making the Document thread-safe.

- Looking over the latest code, Document is not thread-safe. I would
recommend a solution similar to the one offered by the Java 1.1
collections. Have a "standard" implementation that is *not*
thread-safe, and a method on the Document builder that is
"buildSynchronized", that wraps a synchronized wrapper around the

2) Mandating how equals is handled.

- One suggestion is to have a static utility method to compare to two
Documents. The "standard" implementation would use this. Novel
implementations of the Document (if it was an interface) could also
use it.

I'm sure that you covered this, and other issues in your recent post.
I'd really like to read it before I step in it too deeply.

> P.S.  So we meet again Paul.  :-)

Hell, I've been around... You've just been too busy to notice. ;^)

- Paul

More information about the jdom-interest mailing list