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

DZone 's Guide to

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

· Web Dev Zone ·
Free Resource

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.



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}