Ajax Smackdown Dojo versus YUI

Struts University Series Ajax Smackdown

What is Ajax? Why is it popular now? What can it do for my applications? How do we write Ajax applications? Which is the best fit for me?

What is Ajax? standards-based presentation using XHTML and CSS; dynamic display and interaction using the Document Object Model; data interchange and manipulation using XML and XSLT; asynchronous data retrieval using XMLHttpRequest; and JavaScript binding everything together.

How did Ajax Start?

Outlook Web Access for Exchange 2000 DHTML version XMLHTTP ActiveX Ships with IE5 Discovered by OddPost, et al XMLHttpRequest (XHR) is now a W3C working draft War: What is it good for?

Operating-system independence Microsoft threatened Rapid IE releases "Bugs were pouring into the web at a phenomenal rate" By 2000, Netscape is crushed. Can we give peace a chance?

Browser innovation stabilizes AOL disbands Netscape in 2003 MS transfers IE developers to Avalon New computer, new browser February 2005: IE6 83% Mainstream supports XHR MS Way and W3C Way

✗ Ajax AC ✗ Dojo Toolkit ✗ Rico Library

✗ Ajax Client Engine ✗ DOM Drag ✗ RSList Library

✗ AJAX Java Server Faces ✗ Echo 2 ✗ SACK Framework ✗ ICEFaces ✗ Sarissa ✗ AJAX JSP Tag Library ✗ IWF ✗ script.aculo.us ✗ Ajax.NET ✗ JAHAH ✗ SWATO Library ✗ AjaxAspects ✗ Java2Script Pacemaker ✗ Taconite ✗ AjaxCaller ✗ JavaScript GameLib ✗ Tacos Library ✗ AJFormFramework ✗ JPSPAN ✗ ThinkCap JX ✗ AMFPHP ✗ JSMX ✗ Tibet Framework ✗ BackBAse ✗ libXmlRequest Library ✗ WebORB ✗ Bindows ✗ MAJAX Library ✗ WidgetServer Java ✗ Bitkraft (.NET) ✗ Microsoft Atlas ✗ Xajax Library ✗ Catalyst ✗ Plex ✗ XHConn ✗ CL-AJAX ✗ Prototype ✗ zumiPage ✗ ComfortASP.NET ✗

Dojo Toolkit

The “500 lbs Gorilla” of Ajax engines Dojo Foundation  IBM, Sun, AOL  Toolkit, OpenRecord, Cometd Uses Java metaphors AOP event handling Flexible connection manager Dojo Toolkit

Stable but still publishing 0.* releases Reputation for being underdocumented Online Developer Guide API Tool Working test pages

JSON Diagrams JSON Diagrams JSON Diagrams JSON Diagrams JSON Java Libraries org.. SOJO. org.json.me. VRaptor. Json-lib. Restlet. JSON Tools. Jettison. org.json.simple. json-taglib. Stringtree. JSON Remote Procedure Call

Callback Functions

public class Remote { public String getData(int index) { ... } }

Remote.getData(42, handleGetData); function handleGetData(str) { alert(str); } public class Remote { public void setPerson(Person p) { this.person = p; } } public Person { private String name; private int age; private Date[] appointments; // getters and setters ... } var p = { name:"Fred Bloggs", age:42, appointments:[ new Date(), new Date("1 Jan 2008") ] }; Remote.setPerson(p);

Yahoo! User Interface Library

Powers many Yahoo! properties Funded and staffed by Yahoo! AOP-like event handlers Flexible connection manager Stable, publishing 2.x series Well documented, if experienced Overview, Example, and API

Dojo versus YUI

Dojo most popular, most attractive YUI best documented, easiest to extend Dojo is an open source bazaar YUI is an open source cathedral Yazaar = Yahoo + Bazaar Sqare One University Series