The AJAX technique comes in response to the increasing demand of interactive web applications. With AJAX, web page exchange small amount of data with the server behind the scene. This means that every time a new piece of data is entered by the user, or there is a request for a change, the entire page does not have to be reloaded. Usability is also greatly affected thanks to AJAX. After all, AJAX creates conditions that are conducive to a complex scenario that is both data-centric and user-centric. The difference between web pages and other applications has been thinned down with the help of AJAX.
As already mentioned, AJAX is not a technology and this technique fuses together various existing technologies such as XHTML (or HTML), CSS, the DOM, XMLHttpRequest (or alternatively IFrame), XML.
Here is how these individual technologies play a role in AJAX:
- XHTML (or HTML) and CSS are used for mark up and styling information.
- The DOM (Document Object Model) is employed for the actual interaction that happens with the information that is presented.
- The exchange of data asynchronously with the web server happens with the use of XMLHttpRequest. Although there are many cases where an IFrame object is used in its place.
- Even though even preformatted HTML would work, XML is the format often used for the transfer of data between the server and the client.
The advantages and disadvantages of using AJAX are in fact open for interpretation. Here are some of the reasons that are cited as advantages of using AJAX.
- The main reason for using AJAX is to enhance the user experience, and to make web pages behave more like standalone applications.
- AJAX enabled pages load faster because it generates HTML within the browser. The net result of the page loading in a staggered manner is the bandwidth consumption for a web page is considerably reduced.
- The third advantage is widely critiqued because of a common misconception about AJAX - that it is a mix n' match of various techniques, not leaving room for any consistency. Yet with AJAX programmers tend to create a distinct separation between the methods and formats that are employed for the purpose of information delivery. In other words separation between the content that is to be delivered, the structure and style elements of the webpage, and the functionality of the webpage.
On the flip side are the disadvantages that people associate with the use of AJAX.
- Given that, with AJAX, the page does not register with the history engine of the browser, the user is often unable to use the 'Back' function of the browser. Additionally, AJAX also makes it difficult for users to 'Bookmark' a page at a certain stage of us. The solutions created to tackle these problems have not been adequate, and these issues remain unresolved for the most part.
- The possible delay between user request and server response, is an obvious drawback of AJAX. This lag, known as network latency is made worse by a phenomenon that has nothing to with the technologies involved. When a page is rendered in entirety the human eye naturally re-adjusts itself to identifying the changed elements of refreshed page. On the other hand, when smaller portions of the page are rendered individually the user may not see the change immediately and imagine latency when it in fact does not exist.
At the face of it, the disadvantages seem to weigh over the advantages making AJAX seem a less viable option for developers. There is no doubt that AJAX is complex, and there are still not many developers who are acquainted with its language. Yet a change has been brought about with Google slotting AJAX in their applications.
The GWT development cycle is rather straightforward:
- Use Java to design, develop, debug, and test. In this process you may or may not choose to employ GWT libraries that seem of use. You are free to use any of the Java tools that you feel comfortable with - Eclipse, IntelliJ, JProfiler, JUnit.
- Ensure compatibility of the application with the browsers you want to support.
GWT can be run in two modes - hosted mode and web mode.
Hosted mode: Most of the development time ordinarily would be spent in this mode because since your application is run as Java byte code within the Java Virtual Machine (JVM), you can have the benefit of employing the debugging facilities in Java.
The main features of the Google Web Toolkit are:
- Even though, unlike traditional HTML web applications, GWT applications do not need to fetch new HTML pages as they execute, they do in fact need to get data from the server. Also referred to as a server call, this mechanism is better known as Remote Procedure Call (RPC) and enables interaction with the server across a network.
- The presence of dynamic and reusable UI (User Interface) frameworks. The key difference between UI frameworks in GWT in comparison to others is the way widgets (Java classes on the client-side that are used to build user interface) are rendered.
- Full-featured debugging in the hosted mode.
- Allows for the appropriate management of browser history.
- Automatic compatibility with different browsers is yet another attractive feature of GWT applications.
- Yet another feature of the GWT is that it helps you internationalize your applications and libraries.
- GWT allows you to unit test in a debugger and browser.
- The most important feature of the GWT is the fact that it is completely open source code.
For the uninitiated, all this sounds too technical. But the very purpose of GWT is to extract developers from the web of technicalities and give them space to create something that speaks with their end-user. And the demand for interactive spaces online is only going to increase. The AJAX trend is catching up and thanks to GWT developers are able to slowly but surely get over their initial apprehensions about the difficulties that AJAX poses. The role of developers in the development lifecycle of a web application cannot be undermined, but with AJAX enabled GWT their role actually ceases to be just that of typing together back-end operations. Google Maps is an excellent example of the advantages of working with AJAX within the GWT framework. Google map is definitive example of something that is dynamic, attractive and completely user-friendly. Finding locations and using functionalities such as zoom in/out instantaneously is a tremendous advancement. Imagine, having to interminably wait for the page to reload when you click on a location or search for it in the search bar? The very purpose of having the map would be defeated, if it was going to take just as much time to look for a specific location online as it would on a printed map. There are some detractors who say
AJAX enabled GWT is the practical way forward. End-users hardly take this for granted, but the work that goes behind creating this ultimate user-experience pays off. And indeed, GWT has made ease of development possible without losing out on user-satisfaction. With techniques like AJAX, and systems like GWT the future of web development is one that holds a lot of promise for users and developers alike!