Moving the Web Application to the Browser

Until now, when developing web applications we’ve been doing this from the server side. The server does the processing and sends HTML output to the user. Sometimes some validation is done on the client-side, like checks whether the e-mail address was filled in. The actual work takes place on the server. Can’t we move more of the work to the browser?

A proper web-application consists of three layers, as I discussed before: the model, the controller and the view. The view is currently the only thing done on the client-side, in the browser. Wouldn’t it be possible to move the controller, or a large chunk of it, to the client? You build your application using HTML and Javascript, which is quite a powerful combination and from time to time send requests to the webserver asking for or storing data. This communication can take place using XmlHttpRequest. The advantages of this approach are:

  • A lot of the processing can be done by the client, which takes a lot of load off of the server.
  • The web-application gets much more responsive, no more full-page reloads.
  • It will save a lot of bandwidth.

There are some problems with this though:

  • You have no direct access to the user’s resources; you can’t write files on disk, all you have to your disposal is some memory (and you can save stuff through a XmlHttpRequest)
  • You’re limited to what your execution platform (a.k.a. the browser) allows you to do. I’m not very sure how limiting this is, though.
  • If the user’s browser doesn’t support Javascript the way you expect it to, the user won’t be able to use the application at all.
  • And probably the biggest one: the differences in Javascript/DOM implementations which make it an unproductive environment, it may be possible to pass around this with some powerful abstractions, though.

If you wanted to you could even make your web-applications work partly offline. For example an e-mail program could preload the e-mail messages once you log in and synchronize stuff when you’re back online. Not ideal, but it could be done. Just some thoughts for my crusade for richer and more responsive web applications.