Read on and leave a comment
or return to our portfolio.

4 Nov 2005

by Noel

Rich web clients

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:

Tree1
In this picture, the octagon represents the body tag, and the circles represent the paragraphs. If emphasis tags look like a small square, then (zooming in) our picture might look like:

Tree2 
Unfortunately, to make Ajax work, you have to constantly reorganize this tree. The tree is everything: it is the UI, it is the content, and it is the data for the program you are writing. And, I can casually replace any one node with a new node of a different type, or I can insert whole, new subtrees.

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:

Tree3 
The only problem with this is that, if the octagon is a 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).

Spectrum
It may be that Ajax is just the most portable, and least rich/safe way to develop applications for end-users at the moment. Rich clients, likeOpenLaszlo, represent a greater level of safety, as well as a much richer set of tools. Widgets, like Apple’s Dashboard and Yahoo’s Widgets (formerly Konfabulator, an excellent, cross-platform predecessor to Apple’s Dashboard) provide some of the ease of development of the WWW with much of the richness of the desktop—yet there is a run-time engine that provides a modicum of protection and safety for the end-user. And, of course, desktop applications: they sacrifice portability, but give you the full power of the host machine.

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?

Posted in Javascript | Comments Off on Rich web clients

Comments are closed.