The Power and Promise of AJAX
By Niels Hansen
Venice Consulting Group
With the recent increase in buzz and news about AJAX, you may have been wondering why a cleaning product would be getting so much attention. However, the AJAX in question here is a term for a technology that has recently been given this name. Many in the industry believe that AJAX is part of what is shaping up to being known as “Web 2.0”. Whereas the last ten years has seen the laying of the foundations for the web and web access, this new Web 2.0 will see its potential being realized in a greater manner. But what is AJAX exactly? Why is it considered unique? What can businesses actually do with AJAX? And what questions should companies ask?
What is AJAX?
AJAX is not actually one specific technology, but rather the use of a group of technologies together. It’s a particularly great solution for web applications which need functionality that would normally be found only in Rich/Thick Clients (with fuller graphical user interfaces), for example Microsoft Outlook.
How does AJAX work?
There are two main features that AJAX enables. The first feature is the ability to make requests back to the server without having to reload the page. The second part is the ability to parse and work with XML documents.
How is this different from what a standard web page does today? The biggest distinction is that the web page is no longer reloading the entire page and rendering it each time it needs new data from the server. Instead the web browser requests data from the server and then only modifies the specific area or control in the browser. This drastically improves the speed of the web application to the point where it can virtually mirror the speed of a desktop application. In effect, it allows the application to update areas of the web page without stalling the user’s interaction with the web page.
Why is AJAX getting traction?
The biggest problem with AJAX in the past is that it was a Microsoft only solution. It could only work in Internet Explorer (IE) 5.0 because the XMLHttpRequest object was an ActiveX control. So unless your web site only supported IE 5.0, the technology could not be used.
This all changed when Mozilla introduced the XMLHttpRequest object in their Firefox web browser. Soon after, it was also available in the Apple Safari and Opera browsers. For the first time, most of the popular browsers could use this technology. The open source community began promoting this as a new technology. However it was still considered more of a “geek thing” and not used on many commercial sites. To many developers it just seemed too difficult to implement. However everything changed when Google introduced two AJAX-enabled applications: Google Maps and Google Mail (gmail).
Who is using AJAX today?
I mentioned Google as the company which garnered the most attention for AJAX, however they were not the first to actually deploy the technology. My first experience with a commercial application using AJAX was Oddpost.com. The developers at Oddpost.com created a new email client that looked and felt like Outlook. It was pretty amazing in that it never made post backs or refreshed pages. It was so impressive that Yahoo purchased them and will be using it as Yahoo’s next email client to compete against Google’s gmail.
Google’s Mapping client is what I believe got everyone interested in AJAX. The first time you loaded the Google maps you were blown away and could not believe it was a web application. I was convinced at first that it was either an ActiveX control or was using Flash. I quickly tried it out on my Mac using the Safari browser and I was completely stunned that it worked! If you have not tried Google maps I highly suggest you check it out athttp://maps.google.com
Soon after this was released, Microsoft and Yahoo introduced their own AJAX enabled mapping application. Microsoft also refused to be outdone by Google by introducing two sites: http://www.start.com andhttp://www.live.com. Both are portal type pages that display AJAX-enabled components. Microsoft is also re-developing its popular Hotmail and will be introducing an AJAX-enabled version. This was publicly introduced at the Professional Developers Conference in 2005.
Microsoft also has an AJAX-enabled version of Outlook. For companies using the latest version of Exchange, this web version of Outlook is also provided. Feedback from use of the new web version shows that Microsoft has successfully implemented AJAX to re-create the experience of using a client version of Outlook.
The Future of AJAX
The main barrier towards greater use of AJAX technology is that it is still too difficult for the average developer to use. This is not surprising considering the technology is still in its infancy. The real promise of AJAX will arrive when the technology matures and gains the full support of the developer community.
One step in this direction will come towards the end of 2006 when Microsoft looks to release Atlas, a new product with a built in (hyphen) framework into the Visual Studio toolset. Another sign to look out for is to what extent the open source community embraces the technology.
Four Questions to Ask for AJAX Implementation
- What are the ultimate goals for implementing AJAX functionality?
Clearly defining what the goals are at the outset of the project and prior to implementation helps avoid “scope creep” where the continuation of the project grows beyond what was originally intended.
Example: a mortgage application loan origination service company needs to collect data from its users. Normally this would involve a rich client conducting complex calculations on the fly for areas such as best interest rates, and would require the program to continually go back to the server to process data. With AJAX, the user types in the data through a webpage as it hits a complex algorithm in the background on the server which then returns the results incrementally to the website. In this case the overall goal was to decouple the need to use a rich client for the loan processing.
- What specific areas of improvement are you targeting?
Drilling down from the goal to specific quantifiable areas allows for more precise measurement. This might include things such as:
-Greater number of available functions to the user
-Accessibility to a greater number of users
-Decreasing website refresh times
The key is that with older HTTP technology, the user is disconnected from the server and requires a complete refresh of data and the web page. With AJAX, there is a constant connection to the server. Keeping this in mind will help when trying to define the specific areas you are looking to improve.
- What is the Return On Investment?
As should be the case on all major projects or changes, there should be at least a pass at a Return on Investment scenario. The biggest mistake would be to implement AJAX simply because it is the technology “de jour”. Not only does it help the accountability of IT departments to clearly delineate quantifiable returns on investments, but it will also assist in measuring outcomes to determine what adjustments need to be made for optimization purposes.
- Should we outsource?
This is a recurring question that comes up anytime IT projects involve newer technologies that aren’t necessarily the core competency of the company. The answer is usually “it depends”. Considering the newness of AJAX as a technology, most firms choose to look for software development vendors that have the specialized skills required for a successful implementation. During the vendor selection process, make sure they have experience not only in AJAX technologies, but have done extensive work in server background processing; besides the front end user interface aspect of AJAX, perhaps more importantly is experience on the back end.
We’re just beginning to see the tip of the iceberg with the possibilities for AJAX. Firms should take a closer look at their user needs to determine if implementing AJAX should be a priority.
Niels Hansen is a partner at Venice Consulting Group, and has extensive experience working on cutting edge technology such as ASP.NET, PHP, JSP and AJAX. For more information, go to www.veniceconsulting.com.
Appendix: AJAX Implementations
As mentioned earlier, AJAX technology is not new. It uses “XMLHttpRequest” object that was first introduced by Microsoft in Internet Explorer 5.0. The object function allows communication with server to send and request information.
The built-in XML DOM Object in the browser can then be used to parse the XML that is returned from the XMLHttpRequest object.
Finally, DHTML and CSS are needed to dynamically compose and render the HTML for the web page.
To do it yourself method, you need to handle all the requests and call backs. An example of implementing it in a web page would look something like this.
http_request = new XMLHttpRequest();
else if (window.ActiveXObject)
http_request = new ActiveXObject("Microsoft.XMLHTTP");
Remember that Microsoft implemented the technology first and the other browsers follow (followed) suit. Hopefully in IE 7.0 Microsoft will adopt the same implementation as everyone else so that you don’t have to determine if the browser is IE or not.
Appendix: AJAX Frameworks
There are three frameworks that I will discuss here. I do know that there are several frameworks available but ASP.NET, Java or the open source community can use these three and they seem to be the ones that are getting widely used by the community.
Microsoft ATLAS Framework
Microsoft has jumped on the developer bandwagon with an AJAX framework called Atlas. It is currently in beta but they do provide a framework for Visual Studio 2005. It will also be tightly integrated into ASP.NET 3.0, to be released the same time Windows Vista is available. More information on Atlas can be found athttp://www.asp.net/default.aspx?tabindex=7&tabid=47
Java Sun AJAX Framework
Sun has also introduced a framework to use AJAX with Java. It can be found athttp://java.sun.com/developer/technicalArticles/J2EE/AJAX/
Ruby on Rails
Ruby is an open source programming language that also has been getting a lot of attention. This framework was developed to use AJAX with Ruby and is quiet (quite) interesting. If you are interested, check outhttp://www.rubyonrails.org/ for more information.