[jdom-interest] API Inertia
James Duncan Davidson
duncan at x180.net
Tue May 1 20:57:37 PDT 2001
> I think it would help because the Node interface would have
> hasChildren() and getChildren() methods. These would be applicable to
> all nodes. Sometimes hasChildren() would return true, sometimes it
> would return false. Sometimes getChildren() would return a list that
> has members. Sometimes it would return an empty list. This lets you
> walk the tree without caring excessively about the type of each node in
> the tree or without a lot of casting.
I remember once upon a time proposing interface names like "Child" and
"Parent". And then I think that Brett and Jas talked me out of such
nonsense. Interfaces are seductive. Using them to give some amount of
typing information can be a good thing. Using them to allow alternate
implementations isn't always the best way to go (after all, some amount
of that need can be taken care of by Subclassing).
In this case, I actually think it's a draw whether or not interfaces are
useful here. There's good arguments both ways. And in this case, I'm
actually of the opinion that the bed has been made -- we shouldn't flip
over to using interfaces because, quite frankly, we'll have just as much
argument on the other side.
That might be symptomatic of a bit of inertia, but so is the concept of
driving on the right hand side of the road in the US. A bit late to
change and questionable. Though, I can already hear the metric vs. US
measuring standards war as a reply (and I *do* fall into the category of
wanting to go metric!)
> The one exception I'd be willing to make (WARNING: BIG YUCKY CAN OF
> WORMS ABOUT TO BE OPENED) are entities. In fact I'd like to throw
> entities out completely. Here's my logic:
>
> 1. Entities are part of the physical structure of an XML document, not
> the logical structure.Anytime you start mixing and matching the logical
> and physical structures of an XML document the API gets way complicated.
I wouldn't oppose the summary execution of entities.
James Duncan Davidson
duncan at x180.net
More information about the jdom-interest
mailing list