Ouch! My XML Hurts…

I’ve been in the game for a long time (well, about 6-7 years and if 1 year == 7 dog years and one dog year == 7 computer years then you can say I’ve been at it for 343 years (7 x 7 x 7 = 343) which makes me not only experienced but pretty dang old!) and throught that time I’ve heard all kinds of reasons to use XML. I’ve heard plenty of reasons to avoid XML as well. The most common complaint I hear/see/smell/feel/taste is… XML is a pain to maintain

Doctor: What am I seeing you for today?
Patient: It hurts.
Doctor: Where does it hurt?
Patient: Right in the XML.
Doctor: Can you explain more?
Patient: Doc it hurts when I <cough/>. Sometimes I <stretch> and forget to </stretch> and that hurts too. I frequently get an “unresolvable entity” kinda rash and I don’t know how to treat it.
Doctor: I’ve seen symptoms like yours before. No worries. Take two cups of Java in the morning for a week and call me if your symptoms get worse.
Patient: Java? Are you sure? But I have so many tags!
Doctor: Listen. The current trend is to replace those tags with a daily dose of Java. Studies show the results are phenominal. I’ll give you my cell number if you have difficulties.
Patient: Ok, doc. Thanks.

That probably sounds just as stoopid as it looks. How can XML hurt? Sure it’s a verbose langauge at times and in some applications. Sure many people tend overuse and abuse it. Of course it looks silly when it attempts some form of logical control for an application like looping or conditional branching. But does it really hurt people? Think about it. Have you ever been stabbed by an angle bracket? Sliced by a schema? Poked by a processing instruction? Has your hibernate mapping ever slapped you across your face? Have you ever been assaulted by your Ant build file? (Honestly, I’ve been assaulted by my Ant build but that’s another topic not to be mentioned in the context of this here discussion as all information that could eventually disprove my point will be ignored and thrown out of my court of law.) In all practicality, XML and any other language is more helpful than it is harmful. You can make a mess out of any program no matter the language. Appropriately used XML is a powerful technology. Wait till you see my yet-to-come version of XMLInvaders! (Both 2D and OpenGL enabled.)

I typically don’t care one way or another about XML or most languages. As a matter of fact, I’ve said before that I’m normally on the other band wagon beating the drum like, “XML is bad! Down with all parsers!” But sometimes I have to make a point when people misunderstand me. My point here is what? I am not here to preach the gospel of XML or any other language (except for maybe Groovy) even though my earlier musings would have you believe otherwise. However, to call such a language a “general pain” is a bit of an overstatement, one which could indicate lack of understanding or familiarity. XML has its place just as does every other language and it is no more painful to use than say, PHP. T, I ain’t mad at’cha but you should know that when you knock the technology that stands behind my weapons of mass obstruction that I ain’t gonna sit idly by either. Break me off somethin’…

3 thoughts on “Ouch! My XML Hurts…

  1. Allright, I take it back. I only said that, in general, XML is a pain. XML is not a general pain, getting hit by a truck is.

    I was too quick to oversimplify the point that hibernate mappings are more easily maintainable when they are close to the persistent model, i.e. inside the source code. Using annotations has problems as well.

    XML is very powerful, and certainly there are uses for it. There are places where it shines, such as long-term javabean persistence, and places where it most definitely sucks, one of them being Maven POM files.

    Still, the old saying is as true as ever: a bad carpenter blames his tools.

    Awesome post, dude.

  2. Yeah, I know. XML does get in the way of real development at times, particularly when it explodes in mounds of configs. I do get yer’ point. I’ll shut up now since I’ve no experience in Hibernate and/or its mappings.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s