I need to rant: If one more person brags about their class library saying “you don’t have to write a line of code to do <insert cool thing here>, you just need to give it 8 pages of machine generated XML”, I’m going to scream. My perception is that these people believe “code is hard and xml is easy; so if we can transform a problem from code to xml, we make it easy”. There’s certainly some truth to that, but my grievance is that XML is code:
- It looks like code.
- It acts like code.
- It’s provably computationally equivalent to code: they’re both just ASTs; they both have a syntax and semantic structure.
- In these cases, the XML is often sufficiently long and complicated that people want to be able to debug it and set breakpoints in it.
So let’s stop pretending that it’s not code. Clemen Vasters said “XML is the assembly language of Web 2.0“, and I think that makes a lot of sense.
Don’t get me wrong: I love XML. It solves the lexing/parsing problem, and writing parsers is annoying. And it also paves the way for more useful libraries and it lets you start dealing with data at a higher level (serialization, XSL transforms, validation, xpath queries, smart diffs, etc). And if the choice is between 10 lines of XML or 10,000 lines of C++; then obviously I’m going to choose the XML. But by the time your XML files are so complicated that you need a tool to generate them for you and you’re asking for a debugger to debug them, you’ve got to drop the pretense that the xml is ‘easy’.