Random Blog
Join JournalHome.com.
Create your own free blog today.
Create Your Blog
Flag this entry/bog.
It will be manually reviewed.
Report This!

Code Craft
The art, science and craft of writing quality software

Aug. 10, 2005 - The flip side of hammers

Posted in Unspecified

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.

Share |
Post A Comment!

Notify me of followup comments via e-mail.

Aug. 11, 2005 - Get over it

Posted by Anonymous
Typical XML bashing. Do you seriously think so-called lightweight alternatives are better than XML? Where is the XSLT for JSON? Wherer is the DTD or Schema.
Permanent Link

Aug. 11, 2005 - XSLT and DTD

Posted by
My goal wasn't to get in to a flame war over XML, but you raise a good point with regard to DTDs and XSLT, so let me try to answer it. Both are features that are not provided by lightweight alternatives. In most cases, however, DTDs and XSLT are not needed, and they frequently create more problems than they solve.



XSLT, for example is quite cumbersome and most of the examples I have seen could have been done with less work using any normal programming language and JSON. If it was desireable to have a declarative transform system one could be written, but you are right in stating that none exists at present.



DTDs are of even less utility IMO. Hence, you have many alternatives even when working with XML. I am not alone in believing that most are superior. You do not, however, have such a definition language with JSON, so again you are right that if this is a feature you need JSON may not be the right tool.

Edited by codecraft on 8/11/2005 at 3:55 AM
Permanent Link

Aug. 12, 2005 - A SOAP Opera

Posted by Nate
SOAP which is XML based, is one of the best things to happen to network computing since the internet. Yes SOAP has all the problems on of XML (some of which are being solved). However, it is the first truely heterogeneous comunications protocol. Now some of this is due to its roots in XML. XML does allow it to contain truely arbitrary data (for method arguments and return values). The data is defined by xsd.



Yes CORBA and RMI do allow arbitrary data and has IDL (rough equivelant of xsd). So why is SOAP more interoperable than CORBA? Is it because of XML? Partially, but not because its technologically superioir. Rather the trendiness of XML made it be widely accepted and implemented (including by Microsoft).



My point is trendiness whether waranted or not can be quite usefull. And slowly misused trendy technology, is morphing into something better. No XML will not solve all problems, but it is being improved to solve many individual problems.
Permanent Link

Aug. 12, 2005 - Nate is right

Posted by
I couldn't agree more. The odd thing about these trendy elements is that they frequently give the builders of the world an excuse to rethink things, and they often find better solutions than existed before. XML ALSO has advantages over IDL and other ??positional? protocols. XML??s main drawback is really just its verbosity.



I hope I didn't come across as too religious, I am very practical and while I think JSON may be "better" than XML. The differences are not so major that I actually expect the world to rewrite all the good things that were done using XML. BUT, if the lighter weight tool is better for your particular problem then why not use it? That was my intended point.



Edited by codecraft on 8/12/2005 at 12:56 AM
Permanent Link

Aug. 16, 2005 - Of course it was XML!

Posted by Anonymous
Err. So, the stuff that people were using before the term Ajax was XMLHTTPRequest. Note the first 3 letters!
Permanent Link

Aug. 16, 2005 - What's in a name

Posted by Kevin Barnes
1) Strangely the name of the method does not imply that it actually has anything do with XML. Apparently that's what MS thought it would be used for. You can use it to request any arbitrary data and google and almost everyone else does that (gets non-xml data). Don't believe me? go to google maps and run Ethereal and see for yourself.



2) Many of the earliest adopters didn't even use XMLHTTPRequest, they used hidden IFrames or hidden frames. We still do this as a fallback mechanism in our system so that older browsers still work.



Edited by codecraft on 8/15/2005 at 10:25 PM
Permanent Link

Share and enjoy
  • Digg
  • del.icio.us
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
<- Last Page • Next Page ->

Kevin Barnes

Code Craft is the place for my thoughts, rants, ideas and occassional jokes on what it means to write code, why some people are better at it than others, and how we think about software in general.

Copyright (C) 2005, Kevin Barnes. All rights reserved.