A few days back I wrote an article about how Java was missing an important tool from its tool box (the eval hammer). Hammers have a flip side. The odd phenomenon is that when someone is holding a hammer, every problem starts to look like a nail. This can result in some pretty creative "solutions" to problems. My favorite ill-used hammer of late has been XML.
XML is a reasonably poor implementation of a very good (but not new) idea. For a brief period of years it was elevated to near mythical importance. It was going to bring whole industries together and create a re-thinking of the internet. This noise resulted in a bunch of very bizarre uses in some otherwise great tools. ANT and XDoclet both come to mind as extremely useful tools that were made cumbersome because of their XML roots.
If you don´t agree that XML is not a great multi-purpose saws-all, glance at http://xmlsucks.org for a few laughs and see what the creators of ANT have to say. Although I think the world would be a better place if we abandoned XML altogether and used JSON (Object Notation) or any similar lightweight format instead, that just isn´t going to happen and XML is good enough for many purposes.
The recent horribly odd use of XML is with AJAX. For those of you not in the know, AJAX is the buzzwordified name given to using dynamic server calls from to obtain data from a server. This notion is quite useful for (at very least) dynamically populating data based on user selections.
The core technologies were made popular in large part by Google´s usage in GMail and Google Maps, but when the name was coined the concept of using XML to hold the data was added (so far as I know none of the early users of the core technologies used XML). XML is an awful fit for this purpose, but some people seemed to have the hammer in hand and so they made it fit the purpose.
At StorePerform we´ve been using the technologies that make up the heart of AJAX since before the term AJAX was coined (back then we called it the "Gmail-like" framework). Our project has a much more extensive UI than GMail and despite that I have been thrilled with how well it has worked in practice so far. Like all tools it has important limits, and the biggest is that it is only for environments where is a guarantee.
What we did not do, however, was use XML. That is a decision which I am also extremely happy with. We used JSON and it was a great fit. JSON is a very lightweight alternative to XML, and since the target is it´s trivial to work with it on the client side. Parsing on the server side also turns out to be much faster than parsing XML and in our case we were able to hide the format 100% (from the API writer´s perspective) with almost no real effort.
These technologies have a long ways to go, but for us at least they have proven useful. The trick when using a new tool is not getting sucked in to the buzz around it made by people whose purposes may not match yours. As time passes, if great frameworks based on XML emerge that solve other problems for us, perhaps we´ll move over. Until that time I´ll keep using a screwdriver to remove screws and let others try their hand with the hammer.
|