Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
HTML5 Zone is brought to you in partnership with:

John Esposito curates content at DZone, while writing a dissertation on ancient Greek philosophy and raising two cats. In a previous life he was a database developer and network administrator. John is a DZone Zone Leader and has posted 268 posts at DZone. You can read more from them at their website. View Full User Profile

Yahoo's New JavaScript Framework: Will Cocktails Change Your Life?

11.04.2011
Email
Views: 2802
  • submit to reddit
The HTML5 Microzone is presented by DZone and Microsoft to bring you the most interesting and relevant content on emerging web standards.  Experience all that the HTML5 Microzone has to offer on our homepage and check out the cutting edge web development tutorials on Script Junkie, Build My Pinned Site, and the HTML5 DevCenter.

Yahoo caught some eyes recently with Livestand, their new lifestyle app for iPad.

Now they're promising something for developers: the platform and framework they used to create Livestand -- an original blend of hot client- and server-side technologies they (cleverly?) call 'Cocktails'.

The general thrust of the announcement is another 'write once, run anywhere' promise:

Going forward, Mojito and Yahoo! Manhattan will allow you to develop ONE app and deploy it on several devices to lower cost, increase agility and keep a uniform design across platforms (web, mobile, tablet). With the power of Yahoo! Cocktails, you’ll be able to build that app – deployable on several platforms –in the same time it currently takes to build each app individually.

The Yahoo User Interface (YUI) served as foundation for the project. Here's how Satyen Desai, principal software engineer for YUI, explained why YUI's modularity and environment-agnosticism are exciting for developers:

  1. YUI’s core abstraction layer provides a consistent API across all supported environments allowing Cocktails, and hence Livestand to deliver components which can run on both the server and in client browsers across both the desktop and mobile devices.

  2. YUI’s modular structure and dynamic loading support allow for well-encapsulated and highly granular components, promoting a high level of code reuse and maintainability for large-scale Cocktail applications, without burdening the end user with dependency management.

  3. Conditional loading allows YUI, and applications built on top of it, to deliver implementations and code specific to the target environment – so Cocktails can deliver mobile or desktop or server based implementations behind a consistent API.

  4. YUI’s application-level building-blocks provide the infrastructure to build robust, extensible apps efficiently, either on the client or on the server.

For data access, Cocktails is powered by the Yahoo Query Language (YQL) platform, which was originally designed to provide (super-decoupled) SQL-like access to all kinds of web data sources. Yahoo's Mirek Grymuza describes YQL like this:

YQL can be thought of as content multiplexer with a query interface...With YQL's flexible table encapsulation model, expressed through environment files, applications can bundle multiple table implementations in a decoupled manner from the user interface and the client application itself. This allows the application user interface to rely on established content data class, rather than on multiple content endpoints, each with its own semantics. This is a critical piece of abstraction, especially considering the need to manage thin client applications, which often run native code, relying on a software update cycle. The problem is particularly pronounced when this update is controlled solely at user discretion. With YQL, and in this distributed model, the binding with a content provider is encapsulated within YQL table.

 

The theme repeats: the more abstraction, the more agnosticism, the better.

Some open-source projects with similar aims have surfaced before: Joshfire attempts something like Cocktails, and FaxJs offers a nice JavaScript UI framework (with pure JavaScript API). (Yahoo promises to open-souce Cocktails in 2012, though, so maybe the distinction is moot.)

I can't tell how big this announcement really is. The promise is huge, but everyone makes pretty much exactly this promise. And the announcement is just an announcement, not an actual release..so there's nothing for the developer really to see, yet.

Thoughts?

Published at DZone with permission of its author, John Esposito.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

HTML5 is the most dramatic step in the evolution of web standards. It incorporates features such as geolocation, video playback and drag-and-drop. HTML5 allows developers to create rich internet applications without the need for third party APIs and browser plug-ins.  Under the banner of HTML5, modern web standards such as CSS3, SVG, XHR2, WebSockets, IndexedDB, and AppCache are pushing the boundaries for what a browser can achieve using web standards.  This Microzone is supported by Microsoft, and it will delve into the intricacies of using these new web technologies and teach you how to make your websites compatible with all of the modern browsers.