Ajax Frameworks – Server side versus Client side

The advent of Ajax has brought about a lot of frameworks to the bill board, all boasting about their inept qualities in providing you the best from the rest. But how would you go about choosing a right kind of framework for your application.

In order to make things simple, the overall horde of Ajax frameworks can be classified into two major leagues:

  1. Server Side Framework
  2. Client Side Frameworks

Server Side Frameworks
Server side frameworks as the name suggests are used on the server side. But you would ask as to how Ajax, which involves JavaScript is used on the server side. Its not actually JavaScript that is used in such frameworks on the server side. In fact you use the same language API’s provided by the framework to do your client side activities and on deployment these client side activities coded on the server side get translated to normal Ajax functionalities when deployed. Confused? Let me clarify your this with an existing server side framework.

Google Web Toolkit (GWT) is such a server side framework which is used as a normal Java Swing kind of programming on the server side in web pages using the GWT API. The GWT provides a tool for deploying your web application having such pages. During the deployment of the web application the GWT tools help in translating the Java syntax into the corresponding Ajax functionality to be brought on the client side.

Advantage of Server Side Frameworks
The advantage of using a server side framework is that you use the existing language you are working in. You do not have to dwell in the wild wild world of JavaScript. Its easier to use a server side framework rather than to learn JavaScript.

Other server side frameworks are : Yahoo Toolkit, DWR

Client Side Frameworks
You must have done Ajax in the normal fashion using the XMLHTTPRequest object in a JavaScript file and then provided some callbacks to do the asynchronous requests. Providing this much is good enough for a simple Ajax page to do one or two requests. But in a large application much more functionality is required. I would list out some of these functionalities as follows:

  • Cross browser compatibility – When you code its always a necessity that the code works independent of the browser type requesting it
  • Mutliple request handling – Multiple asynchronous request have to handled properly when doing the callbacks
  • Graceful degradation – You don’t want your code to fall flat on its face in case the browser does not support the XMLHTTPRequest object
  • Exception and error handling – You should be able to catch the exceptions in your code instead of displaying it to the user

To do all this yourself is very tedious and requires a lot of JavaScript expertise. To avoid all this mayhem you have client side frameworks to your rescue. They provide packages and API’s which help you to implement all of the above functionalities and also provide a lot of extra features which currently can be either found in free JavaScript code snippets over the net.

The extra features include widgets or even an IDE. Widgets are small interfaces or components which can be incorporated in an application easily through the client side frameworks. These widgets might compose of the following:

  1. Auto completing combobox
  2. A Menu system
  3. An accordian
  4. A tabbed pane windows
  5. Effects like fade, zoom in /out

Advantages of Client Side Frameworks
Besides the above specialties the advantage of a client side framework over a server side framework is that you have the complete flexibility in your hands. You can mix and match the widget features and at the same time provide extra flexibility as you have the world of JavaScript at your disposal. Some frameworks like TIBCO GI even provide a GUI to build your web pages with Ajax components in a complete drag n drop style.

The examples of a client side framework are Prototype, DOJO Toolkit, Rico, Script.aculo.us, etc.

Going out to choose a framework in the Ajax field can be a bit overwhelming since you might think all look the same. But if you keep in mind the above classification then you can well have a feature matrix in front of you and also take less time in deciding on going for a particular one.

5 thoughts on “Ajax Frameworks – Server side versus Client side

  1. Check out this http://www.ajaxdiff.com site which is a new community platform for comparing AJAX frameworks. It is completely open for community contributions allowing adding and updating framework details and indexing related publications. The platform was aired today with initial content and is waiting for you guys to start pumping information to it.

    I will be happy to receive feedbacks. The site is built upon a dedicated framework that will be updated with your ideas.

    Joe Abrams

  2. It is a common mistake to consider GWT as a server side framework. GWT in run-time is a fully client side framework. It is true that you use Java to write the application but that does not make it a server based framework. ASP.NET 2.0 AJAX is partially server based as it allows in runtime to manipulate the client layer from the server. Visual WebGui which I am the project leader is server based as it fully lets you control the client from the server code. The greatest advantage of server based frameworks is security and productivity as you have one layer that is secured on the server, kind of like good old ASP.NET or JSP. In terms of security GWT surly can not be called a server framework as it exposes all your application logic in the client and executes it there.

Leave a Reply

Your email address will not be published. Required fields are marked *