busting-out XML sections

Alex Martelli aleaxit at yahoo.com
Sat Oct 7 06:31:35 EDT 2000


"Thomas Gagne" <tgagne at ix.netcom.com> wrote in message
news:39DEABC2.B0980E15 at ix.netcom.com...
> Alex Martelli wrote:
>
> > <snip>
> > I think it's wrong to assume that the implementation of crucial
> > infrastructure
> > such as XML DOM analysis is defective, just because it *might* be and
thus
> > cause problems if you ever have to process a gigabyte-size input file.
Why
> > not "do the simplest thing you can possibly get away with", as XP
teaches?
>
> I'm curious, in this example, what the simplest thing would be?  I've been

IMHO, it would be using DOM, if you do want to handle XML rather than
just your own peculiar subset of it.  Your burster.py, as fas as I see, will
for example fail if <object> or </object> are not on a line by themselves,
and nothing in XML mandates them to be (or they could be in #CDATA,
etc).  "Handling" XML by actually ignoring its specs is a habit that seems
to be even too widespread already -- there *are* good parsers around,
it's clearly simpler to re-use them rather than incrementally re-invent
them in each and every XML-supporting application program.


> Out of curiosity, is part of what XP is about?  Doing the simplest thing
> first?  Heck, I'm always looking for the simplest way to get something
done (I

Yep.  Of course, learning what IS "the simplest way" that actually does
work is a crucial aspect (reusing existing, solid, well-tested
infrastructure
code, for example; it may not superficially look simpler than rolling your
own, but it almost always turns out to be, for any non-trivial problem --
and parsing XML is NOT trivial).

Anyway, see: http://c2.com/cgi/wiki?ExtremeProgramming for the 12
practices of Extreme Programming, and specifically:
http://c2.com/cgi/wiki?DoTheSimplestThingThatCouldPossiblyWork
for the simplicity aspect.  (I find the Wiki probably the most interesting
way to approach XP, though having read Beck's book, then Jeffries',
Anderson's and Hendrickson's "Extreme Programming Installed",
freely downloadable from http://xprogramming.com/xp_installed.htm,
may be more helpful for actually doing it).


> think I even lead-off the first message in that thread complaining that I
> didn't want to do anything too complicated--or maybe I'm just lazy?

Hate to steal a line from the Perl guys, but the right sort of laziness is a
key plus for a programmer.  It's a good part of what prompts one to reuse
existing components, for example, which is a good thing...


Alex






More information about the Python-list mailing list