[XML-SIG] 4DOM future

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Tue, 02 Nov 1999 14:58:45 -0700


> > Hmm.  I'm a bit unclear as to which way you're leaning:
> > node.get_parent() or node.parent?  I see clearly that you think
> > either is preferable to mixed-case (getParent()), and I agree with
> > you in this particular domain,
> 
> I prefer node.parent.
> 
> > but I'm also interested in your (and others') opinions as to
> > 
> > * Whether the greater pythonic feel of get_parent() or parent is
> > worth the disruption to current users of 4DOM.
> 
> I think the most important point is that all the Python DOM
> implementations share the same binding spec, so the important issue is
> the disruption of current users of any DOM impl. to the agreed upon
> spec.  For that, I'm in the ``do it right, and the sooner the better''
> camp.  Then, after that, I prefer node.parent over node.get_parent().

Agreed.  Unfortunately it may take longer to agree upon and publish a python 
binding that it would to simply come up with an implementation.

For instance, if we go with my leanings, which are towards an attribute-based 
approach, it would differ in a key way from PyDOM.  Then to get a standard 
Python binding, we'd have to hash it out.  That's why it would be nice to hear 
from some of the PyDOM implementors.  It's not going to be an easy issue to 
resolve, but I believe it is worth the effort.

> > * Whether get_parent or parent is superior: there is the Pydom
> > precedent for get_parent() and the ECMAScript precedence for parent.
> 
> FWIW, I don't like get/set routines when a language offers better
> solutions.

Agreed.
 
> > * Whether the __getattr__ & __setattr__ overhead of parent would be
> > worth it for a pure attribute idiom that after all seems to be the
> > intent of the DOM rec.
> 
> I don't process megabytes of XML in short spans of time, any overhead
> would be minimal for me.  Others do process megabytes of XML in short
> spans of time, you should test an implementation both ways since a lot
> of performance issues are already inherent in DOM.  If I were
> designing a system to do large XML instances, I would probably still
> accept 10-15% (though I'd suspect it would be even less than that).
> 
> Between node.parent and node.get_parent() would be node.parent() for
> get and node.parent(value) for set.

Ah, thank you very much for an option I had overlooked.  so now we have four 
options:

A.  The PyDOM way

value = node.get_parent()
node.set_parent(value)

B.  The 4DOM 0.8 way

value = node.getParent()
node.setParent(value)

C.  The pure attribute way

value = node.parent
node.parent = value

D.  The attribute-named method way

value = node.parent()
node.parent(value)


My leaning is to C, Ken McLeod agrees.  I'd love to hear from others.


-- 
Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji@fourthought.com	(970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com		http://OpenTechnology.org