Friday, March 10, 2006

TECH: AJAX - Is this the best approach?


Why is Ajax getting so much attention when there are so many alternative technologies?

This diagram illustrates the superior approach that Rich Internet applications (RIA) have over the traditional web model in regards to user interaction (click here for a better view!).

While AJAX is not new technology its widespread popularity is a recent phenomena. As a new technology approach moves through the hype curve, detractors emerge to raise the innevitable question "Why not something else?". Now we have AJAX - an admittedly powerful approach to web development, but is that because it`s really the best option for the job? If not, does that mean we should expect AJAX to fade away as have other much hyped technologies? First of all, to be clear, I am talking about AJAX as an architecture for web based business applications, not merely a tool for building websites. The truth is there are a lot of alternatives to the native JavaScript, and DHTML facilities of the browser if this is your purpose. Here we look at a few of the most viable choices:

The Alternatives

1. XUL

Pronounced "zool", XUL is a high performance markup language for creating rich dynamic user interfaces. It’s part of the Mozilla browser and related applications and is available in Mozilla browsers (like Firefox). XUL is comprised mainly of a set of high-performance widgets that can be combined to form more complex business applications and components. You can apparently build very sophisticated applications in XUL, but many developers report encountering insurmountable problems when using XUL to build complex interfaces.

Advantages: high performance, fast, works with JavaScript, based on XML
Disadvantages: Only compatible with Mozilla browsers. IE 7 and XAML

2. XAML

XAML is a high performance markup language for creating rich dynamic user interfaces. It’s part of Avalon, Microsoft’s next generation UI technology, and will be supported in future versions of the Internet Explorer browser (on the PC only). It`s also XML based and supposed to allow the development of powerful UI - even in a webpage. XAML is probably Microsoft`s response to other efforts like XUL and AJAX, but is also a natural progression of the convergence of RAD tools and the web browser as an enterprise application platform. We will likely be hearing a lot about XAML over the next decade. Don`t expect it to cross browsers or platforms though.

Advantages: high performance, robust, highly configurable.
Disadvantages: Microsoft-only technology. Not implementable on other platforms. Will not be available until Windows Vista is on shelves.

3. Java Applets

An Applet is a program written in JAVA that can be included on a web page. These code snippets require the proprietary JAVA plugin from Sun to run. They`re written in a language that is ubiquitous and widely known, but are often jarringly slow-to-load components of web based applications.

Advantages: Fast. Supported on most platforms (with the Java plugin). Meets many of the requirements of the AJAX developer from a purely functional perspective.
Disadvantages: Requires the Sun Java plugin, which many organizations will not allow to be installed on workstations due to security concerns. Applets take a while to load when you first encounter one.

4. Flash/Flex

Adobe has an “ecosystem” of products that in some way utilize the virtual machine we know as the Flash Player. This includes the Flash IDE, Flex Presentation Server and Flex Builder Development tools. Both Flash and Flex can be scripted (using ECMAScript 4¬based ActionScript 2 language) and both produce SWF files (compiled bytecode that is interpreted by the Flash Player). The main difference between Flash and Flex is that Flash uses a binary FLA file to store its application structure whereas Flex uses a text¬based one based called MXML. This allows a more modern deployment model using JIT compilation and caching.

Advantages: Flex is now free however they have a highend server for enterprises at a cost, Strong community support, Browser and platform compatibility. Very powerful development tools. Excellent support for rich media.
Disadvantages: Proprietary, Poor acceptance within corporate enterprises. Some challenges with searchability from search engines.

5. Lazlo OpenSource

OpenLaszlo is an excellent open source web programming language based on XML and JavaScript. Your class declarations, object instantiations and configuration constraints are all defined in XML, with JavaScript expressions in attributes and JavaScript methods in text content. The OpenLaszlo platform consists of the LZX programming language and the OpenLaszlo Server. Some say that Adobe copied this same approach with Flex.

Advantages: OpenSource (support may be purchased), Browser and platform compatibility. Speed and flexibility. Increasingly powerful development tools. Flexiblity to deliver as either Flash or AJAX.
Disadvantages: Rare skillset required to do development with these components that most corporations do not have. Issues and Challenges with searchability from search engines, Platform may not be robust enough for large-scale complex applications.

6. SVG (Scalable Vector Graphics)

A text based graphics language that describes images with vector shapes, text, and embedded raster graphics. It can be integrated with XML datasources or SMIL (Synchronized Multimedia Integration Language). It has good interoperability with CSS, and JavaScript.

Advantages: Speed and flexibility.
Disadvantages: Requires proprietary plugins that many firms will not allow users to install. Rare skillset required to do development with these components that most corporations do not have. This language is still somewhat immature and developing.

7. AJAX (Asychronous JavaScript and XML)

A set of native client-side browser technologies that can be combined to build powerful user interfaces and do asynchronous communication with business layer software on the server. My handy definition of Ajax is: DHTML + XHR = Ajax. There are many emerging frameworks designed to help with Ajax app development (Dojo, Prototype, Tibco GI).

Advantages: Powerful and has high level of browser and platform compatibility. No 3rd party platform (except for a browser) required for full compatibility. High interoperability with other web based components and code. Ajax uses the native browser scripting language.
Disadvantages: Somewhat complex and can be quirky to do sophisticated development with, although the basic skillset necessary for interacting with components is quite common.

In Conclusion

Ajax is a natural choice for four main reasons:

1. Solves Business Problems – Ultimately improves user experience and user adoption
2. Platform Independence – OS, Browser and Vendor independence
3. Skillset Conformity – Leverages mainstream skillsets (Javascript, DHTML, XML)
4. Network Effects – Widespread adoption by the marketplace increases its viability

The chart below illustrates the differences in RIA technologies and ultimately the strengths of the AJAX approach. AJAX is rapidly working towards ubiquity and should become part of the common web fabric.




3 comments:

Anonymous said...

Great overview. I think flash still has a place for Interactive Rich Media and Laszlo will be able to play both sides of the fence. AJAX is too complicated right now but the toolsets will mitigate this in the next 6 months.

Anonymous said...

Not Correct. Seems you have taken a high level stab and come to some very absolute decisions (and sadly what might be construed as advice)

AJAX has a host of cross browser / cross platform issues that plagued regular HTML development. It should not score a 4 on your chart. It is in no way a "clear" leader. Pad any estimate by at least 200% for QA, or pick your browser (minor version) and platform. Create a macro to write the following statement:

if(isIE && isMinorVersionThis){
}
else if (isIE && isMinorVersionThat){
}
else if (isWindows && isFirefox && isMinorVersionThis){
}
else if (isMac && isIE && !isOpera){
.... repeat ad nauseam.

XAML will someday rule the universe, something that I am not happy about. But prepare for the inevitable. Sorry Google, MS isn’t going anywhere.

Laszlo and LZX require ZERO learning of new language and syntax, and your developers (if they do DHTML) already know it. It is a matter of learning the process of Laszlo, not the skill set. I doubt that you have really fully evaluated this technology.

Anonymous said...

A couple of other clarifications.

* XAML is in fact going to be cross platform. Microsoft has announced an initiative (WPF/E for Windows Presentation Framework Everywhere) under which they will deliver cross-OS plugins that render a very nice subset of XAML.

* It's misleading to say that Ajax and OpenLaszlo are both "Platform Independent". Ajax is OS independent, but tied to a single platform (DHTML). OpenLaszlo is both OS independent and platform independent (Flash now, DHTML soon). In other words, if you say that Ajax is platform independent, you need to say that Flash is platform independent as well.

* I would say that if you argue Vendor independence for Applets or Ajax, you should for SVG -- Adobe's is not the only implementation, Mozilla has one as well, as do others. In addition, it could be argued that OpenLaszlo is Vendor independent as well -- its open source license (CPL) guarantees that the code will still be available even if the corporate sponsor goes away.

 

Copyright © 2009 by Michael Moir. All rights reserved.