A work colleague and I seem to get drawn into long technical discussions of a fairly robust nature on a regular basis (he may read this and he knows who he is). After the first couple of hours, we generally forget where we started, but that doesn’t seem to matter. We have to stop before our co-workers’ ears start to actually bleed.
One of these epic battles started with me moaning about the deficiencies of XML. I don’t know why it took so long, but it occurred to me that XML is actually a completely pointless technology.
There. I said it. Pointless.
And I mean that literally.
Wikipedia (which long ago supplanted actual knowledge for me) says this of XML:
Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
What a load of crap. XML is only machine-readable with complex code libraries that are far from easy to use (xerces anyone? No? Too much hassle? Really? Wow – who’da thunk?) and being text-based it’s massively inefficient for encoding non-text data. And human-readable? Please! Even when it’s nicely spaced and indented it’s a massive pain to read anything of significant size. And good luck if you actually have to write or edit it by hand and make a little typo somewhere.
Lots of well-argued vitriol about actually using XML for things is floating around on the bloggo-webs (like here and here). This is usually accompanied by recommendations for alternatives like JSON and YAML (which IMHO are far superior), but I think the underlying point is we’ve got this widely used technology standard with (at least) two design goals that it absolutely fails to meet.
So it’s something of a mystery to me how XML has become so ubiquitous, to the point where it’s that very ubiquity that forces us to keep using it. I hate technologies that persist for no other reason than inertia, and I really suspect XML is one of them. The basic point my work colleague made in defence of using XML in the particular context we were talking about (application configuration files) was that ‘well, everyone can read it’.
The practical fact of widespread use is often (unfortunately) the most important factor in such discussions. It shouldn’t be, because it often leads to bad engineering, but it’s a real world consideration, so I’ve written lots of stuff that uses XML. Bad reasons often become clinching arguments in this fashion.
I rather think I lost that particular argument with my coworker, but I like to think I held on to my engineering principles…
For what that’s worth. 🙂
Edit: Stumbled across this post at theprofoundprogrammer which really says it all. With pictures
1 Comments
So YAML and JSON Aren’t Cool Any More? – Technorambling
[…] years ago, one of my very first blog posts was a piece on how terribly XML fails its essential design goals. I mentioned that YAML or JSON were much better compromise solutions to the essential problem of […]