Is it really that taxing...

by Eric Larson

Jeff Atwood mentions the Angle Bracket Tax and not surprisingly, I don't agree. XML can be difficult and painful at times, but I think the reasons are not entirely technical. Recently, I had the opportunity to work with XML in Java and it was definitely "taxing". Even though the process was frustrating, it really had little to do with XML. The biggest pain was actually Java.

After working in Python/Ruby for a good portion of time, declaring types, long CamelCase variable/class names and overly complex Object Oriented patterns feel painful. I'm not much of a Java hacker, so most problems could be chalked up to my lack of experience in the language. While a better understanding of Java would have been helpful, in learning XML and C# I had a very similar (and frustrating) experience, which makes me believe it is not necessarily the XML. After working with XML in Python (and Ruby to a lesser extent), it is clear that the real problem is not an "angle bracket" tax. In fact, I would argue that I got a "tax return" by understanding concepts like DOM, which I became exposed to through JavaScript, rather than Python.

It is fine to think XML is "hard" and as I said before, it can be frustrating. But to consider XML the source of frustration probably is not considering all the factors. Jeff's blog generally focuses on programming and human factors and this is a great example of a human factor. If you expect the static typing, wasteful OO patterns and require IDE support, then you have accepted the struggles as normal. When you then are forced to deal with XML, the common links to OO ideals and patterns don't match, leading you to the conclusion that XML is hard. The people who breeze through XML and enjoy the technology are simply those who have invested a little time in learning basic tools. Of course, these people also have set their own expectations regarding XML, but therein lies the secret.

Programmers are supposed to be logical people who make decisions using reason. The reality is programmers are people with irrational feelings and emotions that impact decision making. There is a good chance your criticisms of XML are rooted in the thousands of blog posts saying XML sucks. There is an even better chance you promote tools such as YAML without ever actually having used it heavily. Opinions obviously have a place in software, but so does logic and reason. The next time you deal with XML, take a minute and try to learn something new before complaining. When I recently worked with Java, I went ahead and put aside my frustrations for a bit to get a good handle on Ant. Lo and behold, it was interesting and I learned something new that helped improve my perspective on Java. If you take the time to learn XML basics with an objective mindset, you might still say it sucks. On the other hand, you might realize it is not so bad.


2008-05-12 11:28:46
I read it twice, and I'm still not sure about your point.
2008-05-12 11:55:32
You make a good point about trying to approach XML from an object oriented mindset. XML isn't hard, making it fit an OO model would be painful.

That said, Jeff's article really struck me as as objecting more to the chronic overuse of XML vice XML itself.

Now, I make my living off of XML, but I can't say how many times I've told people not to use it. Whether it be to replace a database or other datafile that works just fine.

For example, I had a guy who was storing datafiles in CSV. They were pretty much tabular in nature, and were machine generated, so they were 99.9% well formed: No missing fields, no odd characters, pretty much the perfect case for CSV. He wanted to scrap this and go to XML. I asked why and he couldn't tell me other than to tell me all the magic buzzwords about data interchange, human readable, blah, blah, blah. Thing is, the only thing that ever read his data was a program that was working just fine with CSV, and they had no plans to change that. Pointless.

I love XML. It makes perfect sense to me. But it does get jammed into some odd places it doesn't belong.

Joe Johnson
2008-05-12 18:17:32
I agree with you. XML is not a bad thing or an intrinsically difficult thing to learn or work with. It can be very frustrating trying to store xml documents that were written by someone that never expected it to be stored in a relational database. On the other hand the reduction in documentation and mind numbing exercise of integrating less structured data like a comma delimited or tab delimited file makes it worth it to me. The fact that XML is must be well formed or it gets hosed is a great thing. Only those of us that have suffered the pain of stray #%*)'`~ delimiters in some data that ran fine for months appreciate that.
Enough said for now.
Joe Johnson
Sylvain Hellegouarch
2008-05-13 02:03:50
Jeff's article is an article steaming from frustration over a few specific cases in a given context I believe. He says he doesn't want to pick on SOAP and yet uses it as evidence XML is wrong in such a broad general way that it kills any credibility he could have had with any point he was trying to make.

It seems to me he is stuck in the mindset that XML is only used at representing data. It's missing the point that it is because you use those angle brackets that you can then query that data set. That's where the power of XML technologies lies: validating, querying and transforming. The representation in itself is the skeleton that supports the flesh of your data. Comparing YAML to XML is fine if your point is to say "oh look YAML is shorter". Sadly YAML doesn't have any tools to navigate, transform or validate data it describes [1].

XML is all about data (be it a document model or not). Yes it's verbose and adds noise around data but eventually the pain is worth it considering the gain you end up with.

What did hurt XML is the DOM and its really sucky API I think. It was a necessary evil I guess. But tools exist now that make XML is a breeze to work with, Amara [2] is a great example.

I wish people could get a grip and drop the XML bashing. You don't like it? Don't use it. You don't need it? Don't use it. Yeah some folks abuse XML in very offensive ways. Point at those people not at XML (yeah Wikimedia I'm looking at you and your lousy way of using Atom [3]).

I agree with your point that many developers are so stuck in their ways that they'll never admit alternatives exist and can be better at times. Use the right tools for the right job was maybe Jeff's point but it was a poor way of saying it.

[1] Unless you consider Ypath: *ahem*.

Phil Fearon
2008-05-13 12:23:59
I've got to confess I took the bait and added to the 100+ comments on Jeff's Blog.

The blog obviously struck a nerve though. There's a fair few anti-XML people out there, and yes, most agree there are some weaknesses, but these mostly aren't show-stoppers and they often simply reflect the ubiquity of XML.

The thing is, XML is out there, we've got some great tools, customers are now asking for it (for good reason) and we have to deliver.