RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Yahoo! UI Libraries Target Cross-browser Web Development Woes : Page 2

The recently released Yahoo! UI libraries provide cross-browser DHTML and AJAX capabilities with a commercial-friendly BSD License. Unfortunately poor documentation, verbose syntax, and incomplete capabilities mar the experience.

Animation API
The animation API is where the framework starts to provide real value. The approach of the API is to define a series of from and to key states as well as the duration the animation should last from start to finish.

Among the properties you can animate are: color transitions, location, size, and opacity. You can create fascinating displays with relatively little effort in a manner similar to the Dreamweaver JavaScript. However, these API capabilities are only truly useful if you know the precise path of your animation at design time, because the declarative syntax used makes it difficult to alter animation paths at runtime.

Drag and Drop
Drag-and-drop support has always been an area of divergence among browser implementations. YUI does a masterful job of not only smoothing out the differences but adding some great functionality on top of it.

The Drag and Drop API provides a lot of advanced functionality not seen in other freely available JavaScript libraries. The end user experience with YUI drag-and-drop elements is very slick. You can specify what items are draggable and what items are drop targets in a relatively simple, though verbose, way.

I would have liked to have seen YUI behave a little more like some of the other freely available libraries out there in terms of associating drag sources with possible drop targets. In YUI you have to write code (there's an example in the documentation) to specify drop targets as opposed to simply adding grouping tags to your targets as you can with Script.aculo.us.

Connection API
Remote scripting has been around for years but when Google launched Google maps it set the Internet afire with AJAX mania. The mania is of course well-founded, because AJAX can offer a dramatic user experience improvement. The result of this mania has been a tremendous proliferation of libraries that normalize the interface to the underlying browser hacks that enable you to make a round trip to the server for more data without refreshing the browser.

YUI provides a reasonably complete API for remote scripting. It includes the ability to make remote calls, handle successes, and handle failures. If you're using a server-side language that does not yet have a client side API for remote scripting, YUI is pretty good choice.

The code example below highlights the relative simplicity of the YUI connection libraries.

   var handlers = {
     success: success,
     failure: failure }
   function success(t)
     { alert('Yea, success'); }
   function failure(t)
     { alert('Awww.'); }
Despite the fact that the connection library is one of the strong points of YUI, I would still recommend sticking with whatever AJAX libraries are specifically designed for your server-side language. The reason for this is simple—consistency in data type handling will reduce the overall amount of effort required to achieve the desired result. However, if you work in a multi-language or multi-platform environment, the YUI connection library is the better choice.

To be completely honest, I rewrote this article after my initial review. I had half of my review written based on playing with a few of the examples but repeatedly found myself disappointed with so many facets of the library that I had to delete the first article attempt and try again. Overall, YUI is filled with verbose syntax and undocumented bizarre parameter options. Personally, as a .NET man, I'll stick with writing good xbrowser DOM, using DynAPI for event normalization and ATLAS for my AJAX needs.

In sum, the YUI libraries attempt to provide a complete cross-browser DHTML and AJAX API, but while parts of the libraries are rock-solid and work well, the attempt falls short in a few areas and fails miserably in its overall syntax.

David Talbot is the vice president of development for Data Systems International, a company that develops case-management software for the social services industry. His experience ranges from license-plate recognition using neural networks to television set-top boxes to highly scalable Web applications. He is also the author of Applied ADO.NET.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date