[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Greenspun's tenth law rears its head: was InnerXmlis like

greenspun s law
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

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@m... | 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/    |


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.