1. Feb 27th, 2007

    WS-Configuration

    Elliotte Rusty Harold: “There’s a large rebellion over XML config files from programmers who don’t like to type XML and don’t want to learn APIs for processing it. They’d rather limp along with the same scanf code they’ve been using for the last 20 years.”

    Hmmm, ok.

    No, not ok. I actually find this statement offensive, and it’s bugging me. The undertone is clear: “you either use XML, or you’re too stupid/lazy to understand it, go learn some”.

    So no, not ok. Eight years of implementing XML technologies, writing about them, explaining them to others, fishing for bugs, optimizing code, I think just about qualifies me for what I have to say.

    It sucks.

    grep DocumentRoot /etc/httpd.conf
    sed s/wrong/right/ config.rb > config.rb

    But if you’re handing out dunce hats, I’ll wear mine with pride. Everytime I cut loose of one more XML configuration file, I get more work done, have fun doing it, and leave the office at a reasonable hour.

    If that’s the price I have to pay, it’s one hell of a bargain.

    1. Feb 27th, 2007

      Hendy Irawan

      So, what doesn’t suck?

    2. Feb 27th, 2007

      Assaf

      For most stuff, simple text formats work extremely well. I’ve been using Java property files and UN*X configuration files for years, with no apparent brain damage.

      As a rough estimate
      find /etc | wc -l
      returns 2470, not all of which are configuration files, mind you.

      For more complex stuff, I’d go with YAML which has the structure, but is much easier to handle than XML. Especially if you ever need to edit it.

      For really complex stuff, I’d consider why it has to be that complex.

      And, I’m finding a surprising number of places where code works better than static files, especially code that in its simplest form doesn’t look much different from regular text files. The for loop is a wonderful way to eliminate redundancy.

    3. Feb 28th, 2007

      engtech

      I agree with you so whole-heartedly.

      I bought into the XML config file buzz around 2002, switched a bunch of internal projects to it and then had to deal with how often engineers would screw up the XML when editing it by hand.

      I’ve switched to YAML as well and I’m loving it.

    4. Feb 28th, 2007

      Daniel

      Would you be mad if I pointed out that sed command would give you an empty file? Try sed -i ;)

    5. Feb 28th, 2007

      Assaf

      @daniel,

      Not at all. I routinely get my commands, and regular expressions, and most everything else I write wrong, so I just check it and fix it.

      But when I get it wrong with XML, finding and fixing these errors sucks more time out of my day. So I’m going to leave this glaring error in the post as is.

    6. Feb 28th, 2007

      Eric

      In a way I agree, but after using things like SimpleXML (PHP) and especially Amara (Python), XML based configs are simple and easy to work with. With that said, I have found nothing even close in the .NET world (given I haven’t looked to hard), YMMV.

    7. Feb 28th, 2007

      Jonathan Allen

      With MS adding XML support to VB at the language level, I expect the pain factor for me to drop significantly. But as it stand, I perfer short, clean flat files.

      Some people I worked with actually used VBScript files for configuration. When you write “m_Config.ServerTimeout = 50″, that is literally what you get, no questions asked.

    8. Feb 28th, 2007

      joe

      For anyone interested, here’s a longish but good article about using s-expressions instead of xml…as an intro to Lisp, for people who don’t get what all the parens are for.
      http://www.defmacro.org/ramblings/lisp.html

    9. Feb 28th, 2007

      Andrew Norris

      joe,

      Thanks for the defmacro link. I’m already a convert, but that’s the best explanation of lisp for non-lispers that I’ve ever seen — I’ll definitely be passing that one along.

      And here’s another resounding vote for “XML sucks.”

    10. Mar 1st, 2007

      Paul

      My beef with XML configuration files is not addressed with simple configuration files, Java properties files, or (yuck) YAML. It’s the lack of complete specification that irks me. The DTD, XML Schema, or ad hoc specification doesn’t truly encapsulate what the application expects, so I can provide “valid” input and receive unexpected (i.e., invalid) behavior. I would suggest something like Schematron, but at that point we’re essentially using a programming language as an extension to the application when it should just be written in the same language as the application in the first place…

      Or maybe I’ve been using Emacs too much.

    11. Mar 2nd, 2007

      apotheon

      I’m a fan of using either YAML or an S-expression syntax for config files — YAML because there isn’t much pre-built support for S-expression config syntax out there, and I haven’t gotten around to building my own portable libraries for it.

    Your comment, here ⇓

    Or using OpenID