XML APIs

John Cowan cowan at locke.ccil.org
Tue Nov 3 17:47:46 GMT 1998


Stephen R. Savitzky wrote:

> I do not understand your point.  They certainly hold as far as I can tell;

Provided the tree doesn't get modified while traversing it.

> Piling additional complication into the specification in order to ensure
> that every node in the tree will continue to be visited no matter what gets
> done between calls to "toNext", which I believe is what the last spec that
> included iterators attempted to do, is WRONG, because it makes the simple
> implementation impossible and because it becomes too complicated for a
> programmer looking at the spec to guess how it's going to behave.

Well, I disagree with you.  If iterators are to be useful, they must
be robust against changes to the structure being iterated over, or
at the very least they must warn that the iterator is no longer valid,
like the new Java 1.2 enumerators.

> The API is designed to have an obvious model that looks
> like a parse tree.  Any programmer, looking at that API, will ``see'' the
> parse tree in her mind's eye and be able to make intuitive and accurate
> predictions about how it will behave.

Indeed.  But soon after learning about live node lists, this model
will have to be changed or her programs will be dreadfully erroneous.

> They will then discover that, in
> the details of the specification, the intuitive view of the DOM as the API
> for tree-structured documents is WRONG, and that a great deal of non-obvious
> machinery has to be added in order to make it work.

You betcha.
 
> I'm going to go a little further, and define ``natural model.''  The natural
> model of an interface is a class in which all attributes are represented by
> instance variables, and no other instance variables are present.

The trouble with such a "natural model" is that it's dead.  It works
perfectly for values (which have no state, i.e. are immutable),
and for "dart boards" that react to whatever's posted to (thrown at?)
them, but not for anything with any liveness.  A robot modeled by such a
"natural model" would be more like a Barbie doll: poseable, but unable
to move by itself.

-- 
John Cowan	http://www.ccil.org/~cowan		cowan at ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list