OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Greenspun's tenth law rears its head: was InnerXmlis like

[ Lists Home | Date Index | Thread Index ]

At 8:55 AM +0100 9/23/02, Bill de hÓra wrote:

>(why type "appendChild", when I can just type "add"?).
>

Two reasons:

1. Because it's not clear what you're adding. In 1.0d1 there was an
add() method but it was used to add attributes. User feedback
convinced me that was unclear and I should change that to
addAttribute().

2. Because it's not clear where you're adding it: at the beginning?
at the end? at a random location? "append" is much clearer.

Hmm, I'm willing to consider whether append() alone might be
sufficient instead of "appendChild" but I think "append" is
demonstrably better than "add".

Also please keep in mind that I believe firmly that clarity of code
is far more important than the number of characters you have to type
in initially. Shorthand syntaxes are often unreadable. So far, of the
alternative syntaxes offered, the only one that I find personally
more legible than JDOM is pure XML (i.e. XSLT) and that's not an
option within the limits of Java syntax. A couple of the others are
legible enough that I can believe someone else with a different
mindset might find them more legible, but none of them have been
clear winners IMHO.

Your suggestion is pretty good, but I'm hesitant to rely on
indentation to convey meaning. My experience is that unless the
indentation is syntactically significant (i.e. Python) it is too
often wrong and conveys the opposite meaning. Also keep in mind, that
one of my design principles is that XOM by its nature should help
inexperienced developers do the right thing and keep them from doing
the wrong thing. The learning curve needs to be really shallow, and
that includes not relying on best practices that are known in the
community but are not obvious at first glance.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS