Matt likes to provide the dissenting Ajax voice here on untyping.
As overhead on Slashdot:
‘Zimbra’s chief executive, Satish Dhamaraj, says that when he started his company in December 2003, “I really thought that Ajax was just a bathroom cleaner.” Now his San Mateo, Calif., business has amassed $16 million in funding from venture-capital firms including Accel Partners, Redpoint Ventures and Benchmark Capital, the firm that famously funded eBay Inc. Peter Fenton, an Accel partner, says Ajax “has the chance to change the face of how we look at Web applications” and could boost technology spending by corporations, because Ajax is also being used to develop software for big companies, not just for consumers.’”
Ajax is a dangerous and immature technology. It is, in fact, a hack—akludge—to provide rich-client functionality in the browser.
While I’ll acknowledge that Javascript was intended from day one for interacting with the DOM, building entire applications that are predicated on dynamic, untyped tree-transformations is suicide (at best) without significant software development experience and rigor. With that rigor, it’s just dangerous.
What do I mean? Pretend that every HTML element has a shape. If that’s the case, then a document with a series of paragraphs might look like:
body
tag, and the circles represent the paragraphs. If emphasis tags look like a small square, then (zooming in) our picture might look like:
Anywhere. Anytime. And, without any validation or safety. So, I can take my first picture, and insert an entire copy of it anywhere I like:
body
tag, this iscompletely invalid HTML. But that’s not the worst of it; the tree representing all of my interface, content, and data is a massive, and complex, piece of state. So, after part of my program modifies the tree, I have to forever remember that the state has changed. Keeping track of state is already a dangerous part of programming; it is the cause of crashes in unithreaded programs (memory leaks, for example), and a source of huge problems in multithreaded programs (via problems known as deadlock, livelock, race hazards, etc.). This is why Google Mail and other Ajax-y applications are a miracle of hackery: the fact that they run, without completely buggering up constantly, is a nothing short of a holy intervention on the part of some higher being.
Given that the compiler does nothing to check your typing, and that you have almost no run-time debugging support, Ajax (as currently exemplified by Javascript and XML over HTTP) is certainly only version 0.5 as tool or solution for web-based development goes. Or, perhaps it is just part of a space of tools, where some produce very portable/accessible applications, while others allow the developer to produce richer, more interesting applications (while sacrificing portability).
I started this post with a quote about people investing millions in Ajaxy technology. People investing millions in Ajaxy startups scare me; they’re sheep, following the herd. However, Ajax (as exemplified by Javascript and HTML) will mature, and we’ll see tools and frameworks develop that will make application development “safer” and less hack-and-slash. Or, it will be abandoned, the <BLINK>
tag of the new millennium.
Then again, PHP exists, and it’s a large, steaming turd of a language that grabbed significant market share entirely too easily. So, what can you do?