June 26, 2007

Why Digg’s Ajax Icing with JQuery is only Half Good

digg comment systemOriginally they had a touch of Ajax with their “digg” button where a click would submit your digg asynchronously to their server and update the digg count without a page refresh. This feature had been around for a long time and proved to be elegant and easily usable. Of course the lack of a page refresh also saves quite a bit of server bandwidth, but this performance optimization was shadowed by the features usability. Now, Digg.com has just added a little bit more Ajax icing to their traditional web app cake.

Basically what they have done is replaced the threaded comments with comments that are dynamically loaded when the user expands the list. All of the technical details are discussed by the implementor Joe Stump:

Probably the coolest, technically speaking, portion of the new comments is the manner in which most of the page is created. No longer do we create static HTML in PHP and send you a huge HTML page. Instead we give you the basics and, via AJAX/JSON, we make requests to the API and dynamically create the DOM using the FlyDOM jQuery plugin. The FlyDOM JSON templates are a stroke of genius if you’re looking at loading JSON dynamically into the DOM. The advantage of this is that initial page loads are much snappier and you can load the threads you wish to read on demand.

In simpler terms, Joe Ajaxified the comment system using the jQuery library. If you look past a lot of the technical coolness that Joe is talking about you’ll find that the greatest improvement here is performance based. Initial page loads are dramatically reduced by incrementally loading the page. If you look past any Ajax hype this performance improvement is half of the Ajax promise. The other half is usability. And although usability shined with the initial bit of Ajax on Digg.com’s digg button, digg members have declared this new comment system unusable.

In all fairness Digg.com is working actively on fixing the usability issues. It is clear however that usability in this instance came second, which is a mistake.

I work a lot with GWT building full Ajax applications. This is a bit different than Digg. In my case Ajax is the cake. The things that the GWT team does makes me happy. Seeing this Ajax issue at Digg reinforces that the GWT team is moving the project forward in the best direction. To understand this we can simply compare two quotes, one coming from JQuery and the other coming from GWT:

You start with 10 lines of jQuery that would have been 20 lines of tedious DOM JavaScript. By the time you are done it’s down to two or three lines and it couldn’t get any shorter unless it read your mind

Dave Methvin, JQuery front page

This sounds great to me. As a software developer I know the best code is no code. Or less is more. Digg.com made a good technical decision to use JQuery. But this is only half of the story and the half that developers usually tackle the best. Where is the other half?

We want great results, where “great” is defined by how much it benefits end users. Sometimes there are conflicts between what is easy for us developers and what benefits end users the most. When the two are in conflict, end user experience almost always wins.

GWT Team

I don’t think GWT would be the best solution for the Digg comment system since Digg just needed icing for their traditional web application. However, this is really the proper additude to have when developing applications that you want people to use.

Coincidently I’ve just finished writing a GWT example application that acts as an Ajax database administrator for a social news website like Digg.com. It’s a full Ajax application and the fifth example application in my book on GWT Applications. It illustrates how to dynamically load and save all data using JSON or XML on REST or Actions , or using GWT RPC…. basically a lot of server interaction techniques. Its tested on PHP scripts, Ruby on Rails, and a Java Servlet. Althought most of the technically interesting things are not visible, here is a somewhat underwelming screenshot of the applicaiton:

GWT Database Editor

Filed under: ajax, java, gwt, google web toolkit, user experience, javascript, jquery
June 11, 2007

Adobe AIR/Apollo vs Ajax vs Gears vs Flash vs Silverlight vs JavaFX vs GWT

Adobe Apollo, now called AIR, (Adobe Integrated Runtime), the runtime environment that allows you to use existing web technology for apps on the desktop is an obvious next step from building desktop like Ajax applications that seem to be awkwardly confined to a browser window. The technology requires a runtime installation of approximately 10MB, similar to the need to install the Java or .NET runtime to run apps in these technologies. However, AIR stands apart by allowing you to develop your applications using web standard technologies. It also adds desktop application like features including storage on your hard drive.

Also providing storage is Google’s recently announced Gears browser plug providing SQL database like storage from web applications. Both Gears and AIR technologies are responding to a web user’s need for offline storage for their web applications. In favor of gears, the download size is under 10% of the download size for AIR. It appears to be a better solution if you only need to add offline storage to your web application.

On top of offline storage, some of the sample applications for AIR offer a mix of Flash vector based and DHTML user interfaces. Its good to see Adobe taking advantage of Flash, which Macromedia made the most successful browser plugin of all time. And it has had relatively no competition. Until now. It had its crown taken as the king for responsive web applications with the rise of Ajax. Flash is now primarily used for ads, music, video, and games. However, Ajax has not yet won in the category of web application interfaces. A big battle is going on between Google Maps, an Ajax map web app, and Yahoo! Maps, a flash based map web app, (I have to side with Ajax in this case. I still feel like I’m in an emulated environment when I use a flash interface. The buttons aren’t real. This is also one of the downfalls of older Java client apps).

Of course Microsoft sees this battle going on and wants a piece of the action. They have always had great development tools that have really pushed client application development on windows and are now trying to push web application development in the browser with its Silverlight plugin. Silverlight is a very interesting technology that supports a subset of the .NET framework. This means that it is like AIR providing better integration with OS features but differs by running in the browser. The download size is also a subset of the size of the .NET framework at approximately 10MB.

With Microsoft getting in on the action Sun is reminded of an old grudge. It is the company behind Java and once had a compelling browser plugin like Silverlight that provided richer desktop app like features inside the browser. Java applets still crop up from time to time but have nowhere near the usage that Flash has. Recently Sun announced JavaFX as a lightweight framework to build rich applications that seems to be a response to Microsoft’s Silverlight.

As a developer of client side web applications this can be very confusing. Do you write an Ajax application with web technologies like JavaScript and leverage Gears for offline storage, or use ActionScript to build an app based on Flash, or use .NET languages for Silverlight, or Java for JavaFX. Thankfully Adobe AIR has decided to leverage existing web technologies. This is one reason the web has become a better application platform for many apps than the desktop. However, Silverlight and JavaFX use non web standard technology because Java and .NET are better for building and maintaining larger and more complex applications which web standard technologies were not built to handle.

This brings us to where GWT fits in. It uses Java to allow developers to build larger applications and compiles the code down to web standards. It can’t be used to build the multimedia applications that Flash is known for, and Silverlight and AIR are aiming for, but it is the most compelling solution for building Ajax applications.
From a corporate perspective, It’s refreshing to see these large companies providing innovation on the web. It is important for them to have a decent amount of web technology real estate. And with many multi million dollar acquisitions of Web companies this web technology competition fits the place of the Netscape/IE competition in a modern day dot com bubble.

Links:

Filed under: ajax, java, gwt, google web toolkit, dojo, javascript, AIR, Apollo, Gears, Flash, Silverlight, JavaFX
November 1, 2006

Why there aren’t any Good Tools for JavaScript

Dietrich Kappe has a nice post on the Pathfinder Agile Ajax blog about Bruce Johnsons remarks on the complexity of building tools for dynamically typed languages.

I think its important to note that, along with the halting problem, the reason that dynamically typed languages like javascript don’t have great tools is because they started out as languages for small tasks. Their advantage is that they don’t need complex tools - maybe just a text editor. You can whip up a script, debug, and maintain it very fast.

In contrast, typed languages are designed from the start for large maintainable projects. The extra language features they have are there for more than the support of their tools. They support readability, organization, and compile time error checking.

In other words, why make a tool for a language that wasn’t designed for tools? Why use a scripting language for a large project? Also, why build applications on web technology designed for documents? I can actually answer that last quetion… but another day :) .

Filed under: ajax, java, gwt, javascript