On the proper use of XML



  • I was in a chatroom discussing a project. Here are the logs (some confidential stuff replaced with "[ANONYMIZED]" and nicks changed)

    **** BEGIN LOGGING AT Sun Aug 27 18:02:34 2006

    Aug 27 18:07:55 --- ProjectHead gives channel operator status to Me
    Aug 27 19:14:50 <Me> Hello?
    Aug 27 19:14:55 <Me> Any work for me?
    Aug 27 19:15:44 <ProjectHead> hmmmmmm, know anything about xml?
    Aug 27 19:17:48 <Me> A little
    Aug 27 19:19:27 <ProjectHead> well we are going to need to build an xml parser
    Aug 27 19:19:35 <ProjectHead> but thats going to be a big step
    Aug 27 19:20:32 <Me> Python doesn't come with anything?
    Aug 27 19:22:50 <Me> http://docs.python.org/lib/module-xml.sax.html
    Aug 27 19:23:10 <ProjectHead> well, what we need is for it to parse xml
    Aug 27 19:23:17 <ProjectHead> and then execute the command thats in the xml
    Aug 27 19:23:42 <ProjectHead> e.g. <command> make -f [ANONYMIZED].mk </command>
    Aug 27 19:23:47 <ProjectHead> except
    Aug 27 19:23:57 <Me> Or http://docs.python.org/lib/module-xml.dom.html
    Aug 27 19:24:03 <ProjectHead> <command1> <command2> <command3> etc etc
    Aug 27 19:24:07 <ProjectHead> or something like that
    Aug 27 19:24:46 <Me> <command#> is ugly shudders
    Aug 27 19:25:34 <ProjectHead> we will find a way to do it
    Aug 27 19:26:30 <Me> Why not a series of <command>
    Aug 27 19:26:39 <Me> Actually, why do we need XML for this?
    Aug 27 19:26:55 <ProjectHead> its not "needed" but it would probably be easiest
    Aug 27 19:27:06 <ProjectHead> I'm not sure how else to go about reading commands in the order they appear
    Aug 27 19:28:53 <Me> How about having the commands be in just a text file?
    Aug 27 19:29:35 <ProjectHead> well how do I get it to parse it in order?
    Aug 27 19:30:13 <Me> http://docs.python.org/lib/bltin-file-objects.html
    Aug 27 19:30:30 <Me> Or just use a for loop
    Aug 27 19:31:00 <ProjectHead> so next()
    Aug 27 19:31:01 <ProjectHead> ?
    Aug 27 19:31:13 <ProjectHead> readline()
    Aug 27 19:31:28 <Me> You don't even need readline
    Aug 27 19:31:30 <Me> Just
    Aug 27 19:31:38 <Me> for L in some_file:
    Aug 27 19:33:02 <ProjectHead> hmmmm
    Aug 27 19:33:11 <ProjectHead> fell free to impliment
    Aug 27 19:34:32 <Me> Where should it be implemented
    Aug 27 19:34:40 <ProjectHead> in [ANONYMIZED].py
    Aug 27 19:34:55 <ProjectHead> basically we need to take out all the commands
    Aug 27 19:35:03 <ProjectHead> and have it just read each line
    Aug 27 19:35:05 <ProjectHead> one by one
    Aug 27 19:35:11 <ProjectHead> executing that shell command
    Aug 27 19:35:26 <ProjectHead> I'm working on the logo and site right now
    Aug 27 19:36:38 <Me> Shouldn't we make it easier than that to make profiles?
    Aug 27 19:36:45 <Me> Otherwise, what's the point?
    Aug 27 19:37:19 <Me> <SomeoneFromAnotherChat> why not just take a filename, and send the shell the command sh (filename)?
    Aug 27 19:38:13 <ProjectHead> well how else can we make it easier?
    Aug 27 19:39:23 <Me> Specify a download location
    Aug 27 19:39:55 <Me> make targets if it's more than just the ./configure make make install
    Aug 27 19:40:34 <Me> Otherwise, what's the point of [ANONYMIZED]?
    Aug 27 19:41:16 <ProjectHead> Well [ANONYMIZED] is to make things automated.
    Aug 27 19:41:33 <ProjectHead> software from svn and cvs can be a bitch to make
    Aug 27 19:41:37 <ProjectHead> with all the commands
    Aug 27 19:41:59 <Me> I am assuming that [ANONYMIZED] is to be more than just a shellscript
    Aug 27 19:42:13 <Me> err
    Aug 27 19:42:25 <Me> Better than a shellscript
    Aug 27 19:45:35 <ProjectHead> yes
    Aug 27 19:46:02 <ProjectHead> Also I don't remmebr If I told you but it will probably be implimented into a package system I worked on
    Aug 27 19:46:05 <ProjectHead> called [ANONYMIZED]
    Aug 27 19:46:30 <Me> URL?
    Aug 27 19:47:12 <ProjectHead> http://[ANONYMIZED]
    Aug 27 19:47:17 <ProjectHead> and that will be made cross plateform
    Aug 27 19:49:39 <Me> Where's the documentation
    Aug 27 19:49:46 <ProjectHead> ?
    Aug 27 19:49:50 <ProjectHead> on how to use it?
    Aug 27 19:50:08 <Me> And on what it is, precisely
    Aug 27 19:50:24 <ProjectHead> well its a package system
    Aug 27 19:50:26 <ProjectHead> you install it
    Aug 27 19:50:31 <ProjectHead> you do [ANONYMIZED] -i program name
    Aug 27 19:50:33 <ProjectHead> http://[ANONYMIZED]
    Aug 27 19:50:41 <ProjectHead> it grabs the program from there and it installs it
    Aug 27 19:58:34 <ProjectHead> [ANONYMIZED] -u uninstall
    Aug 27 19:59:54 <Me> And how does [ANONYMIZED] fit into the picture, precisely?

    Aug 27 20:06:47 <ProjectHead> [ANONYMIZED] is a cvs/svn builder
    Aug 27 20:07:30 <Me> So the cvs/svn commands don't need to be built into the profile?
    Aug 27 20:07:44 <Me> And will make stuff be automated if it's a default?
    Aug 27 20:08:14 <ProjectHead> well, I guess they probably should be built into the profile
    Aug 27 20:08:20 <ProjectHead> but yes it will make stuff automated
    Aug 27 20:08:21 <ProjectHead> e.g.
    Aug 27 20:08:25 <ProjectHead> all the commands needed
    Aug 27 20:13:58 <ProjectHead> make -f
    Aug 27 20:14:01 <ProjectHead> svn co......
    Aug 27 20:14:08 <ProjectHead> etc etc
    Aug 27 20:25:39 <Me> And how is that different from just a shellscript?
    Aug 27 20:26:05 <ProjectHead> well it doesn't matter.
    Aug 27 20:26:18 <ProjectHead> I know python so I'm coing it in python
    Aug 27 20:32:25 <Me> So, instead of writing shellscripts, we're doing this stuff in Python because that's what you know?
    Aug 27 20:35:00 <ProjectHead> well, I created the project you can write it in shell script
    Aug 27 20:35:04 <ProjectHead> package system is in python
    Aug 27 20:35:12 <ProjectHead> I see no point to changing it



  • "The real WTF" is that you talk with ProjectHead, about work on sunday evening IMHO ;) (I assume it's your main/only job).

    Or it may just be a time difference...



  • It was actually just a side opensourceish project, not a real job



  • Perhaps the project manager should actually learn how to use Python before he tries to program in it.



  • I've heard of plenty of XML abuses, but I've never seen anyone try to abuse a flat file before.  Isn't a sequence of commands on each line almost the definition of a scripting language?  And aren't XML parsers one of the most common components in the world?



  • Why would anybody choose to donate their time to a project headed by such a retard? I would never have the desire to contribute under such circumstances.



  • [quote user="HeroreV"]Why would anybody choose to donate their time to a project headed by such a retard? I would never have the desire to contribute under such circumstances.
    [/quote]

     

    I have a coworker whom the legendary RMS asked to write a tutorial for EMACS like he (my coworker) did for Scheme.  Here are his comments on working "with" RMS:

    it's pretty insane working with him actually...

    ...he doesn't believe in having a pc connected to the internet...

    ...he has a homebrewed email system where all batch downloaded to a laptop and then he answers your email and batch uploads them at a later date...

    ...so every email he responds to is 3 emails earlier than the one you sent him...

    ...he also batch downloads any web pages...


    ...since my entire draft tutorial is a linear progression of pages,
    this meant he could only download one page at a time and then comments
    on it and then writes "i'll download the next page now"- then three
    days later he sees the next page


    ...this was frustrating because he kept complaining that things
    weren't explained well enough because he couldn't see that they were
    explained on the next page


    so eventually I put all the pages together into a mondo page and now the process is working a lot better

    ...first thing he made me do is remove all tips for Windows users from the entire tutorial
    i'm also not allowed to mention anything in the reference section that isn't free- So I couldn't mention any books


    ...the comical thing is that the 2 books I mentioned are both
    available free online as a download, but not licensed under the GPL...
    I don't know whether I should mention this, or if something is
    automatically not free if it isn't licensed in the GPL, even if it is a
    free download 




  • The real WTF here is that you're creating Yet Another Package Manager, as if the thousand or so already created weren't enough. I deeply hope that this endeavour dies before anybody else has to use it. These things are always awful (probably because doing the job right is more work than it's worth). Please stop.

    Oh, and that this particular part is a very poor reimplementation of either make or the shell. Go take a look at the Debian or FreeBSD source package systems for examples of how to do this right (the answer there is "just use a makefile"), and the Redhat one for an example of why going down this path will lead to misery and pain (their reinvention of the shell is amazingly complicated to maintain, understood by very few of its users, and the source code is an utter nightmare - it's probably the worst part of RPM).



  • Amazing ! Actually if you can convince him to use shell scripts you will have redone portage (Gentoo).

    What's the point ?



  • Hmm, the first thing that came to my mind when reading that was Portage...



  • Yup... portage comes to mind.

    Crazy thing is that some years before Gentoo, I've written utilities for solaris to do basically the same, but without code repos...

    It was bash/awk script in cron loading all program 'modules' and (for example for bash): check `bash --version`; check 'LATEST', or similar link on official ftp; optionally download, get options for building from module's config, build, install.

    Oh good times :D Crazy - but allowed to have normal, frequent updates for gnu environment under this strange system...

    (by the way - that was the time, I've learnt, that you can do everything with bash, sed, awk and wget - you really don't need anything else :) ) 



  • There's just so much wrong here, it's hard to know here to start.

    I've seem people so in love with XML that they can't operate without it.  But I've never seen someone so far gone that they'd use it to store a list of lines.  Usually they use XML to replace the "key=value" stuff, because that's just too hard to parse correctly and you've have to add half a page of code when linking in a 200K library would be faster.  Maybe this person didn't know what XML really was, except that it was a buzzword that other projects used, and you could store and retrieve data with it.

    Then there's the fact that this ProjectHead didn't know what the heck a file was in the first place.  I mean anyone who's ever used a file knows that you can read the file sequentially.  The lines don't show up in a random order.  And since it's extremely hard to learn any programming language without using files, this guy basically has no useful experience with programming.  It's also unclear if ProjectHead understood that the XML would have been stored in a file, which required reading it back in sequential order...

    It's understandable that he would say "software from svn and cvs can be a bitch to make".  I'm pretty sure he finds most tasks on a computer to be difficult.

    To be fair, if this project is going to be cross-platform as claimed, then shell scripts are the wrong way to go, and even just being able to execute an arbitrary command doesn't help much (too many command incompatibilities, file and directory naming conventions, PATH issues, etc).  Making something cross-platform is not a task for a novice.

    I suspect that this ProjectHead just picked up on something he thought there should be a tool for, and started the project without first getting the competence or experience to do so.  People still learning to program (and who only know one language) can sometimes be useful open source contributors, but a project head needs more battle scars.



  • Here's the quick and dirty root cause analysis:

     "Aug 27 19:35:26 <ProjectHead> I'm working on the logo and site right now"

    RiIght there, you know why it's all fnarked up.



  • [quote user="viraptor"]

    - that was the time, I've learnt, that you can do everything with bash, sed, awk and wget - you really don't need anything else :) ) 

    [/quote]

     Like hell you can! How would you do arbitrary precision arithmetic like that?

     Obviously you have to also have dc.
     



  • [quote user="quamaretto"][quote user="viraptor"]

    - that was the time, I've learnt, that you can do everything with bash, sed, awk and wget - you really don't need anything else :) ) 

    [/quote]

     Like hell you can! How would you do arbitrary precision arithmetic like that?

     Obviously you have to also have dc.[/quote]

    IIRC, Bash scripting is Turing-complete.  Therefore, you can do arbitrary-precision arithmetic using it.



  • [quote user="Carnildo"]

    IIRC, Bash scripting is Turing-complete.  Therefore, you can do arbitrary-precision arithmetic using it.

    [/quote]

    You can write a functional assembler in bash. Somebody did. There aren't any real limits on what you can do with it, only on your sanity.

    (Remember folks, perl was created because sh is a stupid language to be writing your program in)



  • [quote user="asuffield"]

    (Remember folks, perl was created because sh is a stupid language to be writing your program in)

    [/quote]

    And Perl is better how? ;)



  • [quote user="darin"]Maybe this person didn't know what XML really was...[/quote]

    Indeed.  It's examples like this that give XML a bad name.

    It is my experience that many a world-be-developer's logic runs something like this;
    "I have a bunch of arbitrary data, I think I'll just wrap a couple of tags around it and call it XML!"

    A good XML format almost never looks anything like the format it replaced (where one existed).

    In the case given (IMHO), the mistake is stuffing the actual shell commands into XML rather than just the metadata those commands imply - the XML parser should have replaced 'make' but instead it just added a worthless layer on top.

    Somebody once said;
    A new technology doesn't succeed because it's better than the old, it succeeds because it's worse than the old but more convinient.



  • [quote user="Seltsam"]

    I have a coworker whom the legendary RMS asked to write a tutorial for EMACS like he (my coworker) did for Scheme.  Here are his comments on working "with" RMS:

    [/quote]

    Another funny RMS story.

    A buddy of mine is getting a graduate degree at MIT.  He and his office mates found a couch sitting around in the hallway.  It seems that generally at MIT when you leave something lying around in a hallway, it means it's free game, so they grabbed it for their office. 

    After asking around for a while, the found out that the couch used to be in RMS' office and that he was getting rid of it because he was replacing it with a bed.  In his office.  


Log in to reply