January 27, 2008

Technologies for better web based applications: XMPP, Flex, and more

Posted in Future of Web Apps, Software at 21:39 by graham

The difference between a web site and an application is that an application is more dynamic, more responsive, to the user. A traditional web site is a set of pages you browse through, like an online catalog or brochure. A web application needs to be more interactive in two ways: By having a richer graphical interface, and by having real-time data. Here’s how.

A richer graphical interface

This is mostly done today by using Javascript. This is a good approach to start with, but your Javascript can quickly get quite hairy, and there are certain things you simply can’t do, such as interactive graphs, flexible typography, or socket connections (which matters in the next section). If you do use Javascript, I recommend the Yahoo User Interface Library.

For a richer environment that is easier to work with, and if you create a graphically rich web application in Javascript you will yearn for both, Flex is the way to go. It is a free (as in beer, unfortunately not yet as in speech) SDK by Adobe that allows you to write graphically rich and responsive applications that run in the Flash player. Flex already has a lot of traction, see O’Reilly books sales for 2007. Bruce Eckel was so impressed with Flex that he went to work for Adobe (as a consultant).

If you can accept targeting your application only at Firefox, for example for an in-house app, then an alternative is to build it as a Firefox extension.

Real-time data

AJAX has given us more responsive web applications, by allowing them to fetch data from a server programmatically. This is what gmail does to check if you have new e-mail. AJAX, or more correctly the browser XmlHttpRequest object, solves the problem of a client fetching data from the server., but it does not allow a server to tell a client that there is new data to fetch. Currently most servers will just check at regular intervals. There are currently two ways to allow the server to push data to the client.

You can trick the browser into keeping your HTTP connection connected, and receive data this way. There are many very nasty ways of doing this, collectively known as Comet.

Or, you can allow your web application to chat, using IM, with your server, or with anything else on the XMPP network. This is a fantastic way of making your app ‘connected’, receiving live data about anything you care to send it. Other people are saying this better than me, such as Matt Tucker here – a less technical summary is here.

There is an XMPP library for Flex, called XIFF. I’ve blogged some documentation about using XIFF.

Applications that just happen to come from the web

So, what can a desktop client do that a browser originated one can’t?

  • Drag and drop from the OS, for example to upload a file, is still difficult. In Firefox the dragdropupload plugin makes this easy. In IE there are some ActiveX’s. For a cross-browser solution you have to turn to Java, see here drag drop file uploading in Java. I wish Flex / Flash did this.

  • Desktop integration, such as minimizing your application to the taskbar. If you need strong desktop integration, you could use Mozilla’s Prism, or write an Adobe AIR application. In most cases launching your app from a button in the browser toolbar instead of from the OS menu doesn’t make a difference to the user.

  • Work offline. If a user is offline, they aren’t getting their e-mail, can’t get to their network shares. They will be quite unhappy. The fact they can’t access your application will likely be far down their upset list, so for most applications this doesn’t matter much. For those apps where it does matter, there is Google Gears which is wrapped by the Dojo offline toolkit. Firefox 3 also has offline support.

Let’s be sensible now

I am not suggesting you build your whole application in Flex, or that HTTP be replaced by XMPP. That would be ridiculous. What I am saying is that if you add these to XHTML, CSS and Javascript, you get a much better web application, which allows an even greater proportion of the world’s software to be web based, with all the advantages that that entails.

Yesterday: cgi-bin/submit.pl. Tomorrow: the world.

Leave a Comment

Note: Your comment will only appear on the site once I approve it manually. This can take a day or two. Thanks for taking the time to comment.