I was recently sent an article from the current issue of eWeek titled Gosling Outlines the Trouble With AJAX. Don’t get me wrong, I have tremendous respect for Dr. Gosling. He’s fantastic if you ever get the chance to see him speak live. I’m also a fan of the eWeek publication. But...
I have a couple of problems with this particular interview. I think it’s fair to say Dr. Gosling has an agenda, (Sun most certainly does).
First of all, I notice that once the first question is posed, we’re immediately treated to the JSF pitch. JSF, we’re told, plays very nicely with AJAX, (and I suspect SOA too, if he were asked).
Next Dr. Gosling mentions how difficult AJAX is; merely a common myth.
"Creating [AJAX components] is extremely hard. Not because programming JavaScript is hard, but because all these flavors of JavaScript are ever so slightly different."
This is where frameworks like Prototype really pay dividends, (right Rob?). Even if one doesn’t take advantage of all the wonderful custom/proprietary functions they supply, the code needed to handle the browser incompatibilities alone (e.g., XMLHttpRequest) is worth your trouble.
Dr. Gosling also complains about debugging AJAX apps, another of the points commonly made by the nattering naybobs.
"And you have to figure out how to test them. None of the browsers has decent debugging hooks….Petty much all you can do is include a bunch of printf's-capture the log input as printf's-[with] no ability to look at variables or segue points or single-step things. There's no ability to do cross-platform QA; you've just got to do them one by one."
As Stuart Halloway says, "Develop in Firefox. Test in IE." Firefox extensions like DOM Inspector, Web Developer, and Firebug; utilities such as JavaScript shell 1.4 ; and full blown testing frameworks like JSUnit address the problem of debugging client side apps quite well.
Remember, developing AJAX does require us Java developers to change our thinking a bit. Model 2 gets turned upside down a bit once you start sending data and presentation simultaneously to the client. This is not necessarily a step back!
Maybe I’m a bit sensitive. Does anyone else have a similar reaction?