Wednesday, November 2, 2011

Yahoo reveals their Node.js Mojito Manhattan cocktail mix - now I can talk about it?

Today Yahoo announced a portion of a new web application platform, Mojito and Manhattan.  It's a project I worked on while at Yahoo and todays announcement somewhat frees me up to talk about this exciting platform in public.  Coincidentally the yearly YUI Conference begins tomorrow and there's a couple sessions which will talk about Mojito and Node.js.  However it doesn't appear the platform tools etc will actually be available for a while yet.
The naming theme in this project is "cocktails" which they arrived at in a backwards way.  They mashed together the words "module" and "widget" to make a new word, mojit, which then led to Mojito and the other cocktail names.  It's really too cute for words, especially with the other (as yet unannounced) cocktail names associated with other (as yet unannounced) projects in the Cocktails family.
Mojito - It's not just for the drinks section anymore

The two parts are:
  • Mojito: A module/widget/mojit system meant to build application UI's that live in HTML5 (or lesser capability) web browsers.  It also applies to mobile device applications because the mobile programming platforms let you incorporate browser components in the app UI.
  • Manhattan:  A cloud oriented hosting infrastructure for Node.js.  It's not simply Node, but Node plus a whole bunch of layers and geared in part to be a hosting platform for Mojits to live in.
Perhaps it should have been obvious that Yahoo was seriously interested in Node.  There's been a series of YUI Theater video presentations (linked below) starting with a video a year ago where Dav Glass gushed over and over and over about the game-changing power of being able to run YUI code on a server environment using Node.  What that launched was a significantly large project to build a complete hosting platform which Yahoo could use to develop new web properties, and be opened to the public so non-Yahoo's could host applications on Yahoo's infrastructure.
An article on today describes the hosting platform as being akin to Google's AppEngine - and, yeah, that's the intention.  It's not a cloud infrastructure like Amazon's EC2 where you're able to rent virtual machines you configure from the metal on up.  Instead it's a platform into which you deploy code conforming to a language (JavaScript) and various API's (Mojito, YUI, Node, etc).  In todays announcement they talk quite a bit about running code on either client or server, unchanged.  But the line of reasoning you see below suggests this code, in order to execute in either server or client environment, cannot take advantage of all the Node API's or all the browser API's.
The idea is to assemble a Mojit using a hybrid Node/YUI package structure, then deploy the tarball into Manhattan.  Unfortunately I feel constrained in what I can say because Yahoo hasn't properly unveiled the product details yet, and at the time I left the team in June we were still in early stages of putting the platform together.  Yahoo says that Manhattan is a cloud hosting platform, but in June … uh … Anyway, what I'll do is go over their blog posts today and see what I can expand upon.
Cocktails: Cocktails makes it simple to build, personalize and modify content for all consumer platforms, and to connect audiences with premium content.
Yahoo has a long history with an earlier platform for mobile applications, Blueprint, that detects device characteristics and customize the actual HTML or WAP code sent to the device based on the device grade.  In part that knowledge is being applied to Mojito.  Not that Blueprint is being used in Mojito.  Instead they're re-applying that knowledge to Mojito.
In the videos in their blog entry, Ren and the others talk about the freedom of having your code being able to run on either server or client, because it's JavaScript at both ends.  In my book, Node Web Development, I talked about how this dream goes back to the earliest days of the Web - the original hype around Java was this same dream, that you'd have Applets doing dynamic things in the browser, and Servlets doing dynamic things in the server, and we'd sing praises to high heaven in a glory of nirvana.  That dream fell down somewhere however and running Java in the browser is basically dead.  The Mojito team wants to enable that dream with JavaScript, by allowing Mojito code to execute on either server or client depending on various characteristics of the browser, server, connection…etc
Part of this is enabling the YUI library to run on either server or client.  Manhattan is a hosting platform for Node, and while Node modules are excellent they're not quite compatible with being executed on a browser (client).  They've published a few videos (linked below) about this idea, using YUI code in a Node module.  Clearly for code to execute either on server or client it needs to use an API set that can run on either client or server.  Because Node's API isn't compatible with running in the browser, this is where YUI comes into play.
Something which is puzzling me - which their blog post doesn't address - is the lack of a DOM in Node, while most of the YUI modules operate on the DOM.  The DOM is the byproduct of a web browser loading a page from a server, parsing the page content into an object model, which it uses to render the page.  Node isn't a web browser and doesn't have a DOM.   YUI's original reason for existence was to abstract away JavaScript inconsistency between browsers and to add niceness to DOM manipulation.  A DOM which doesn't exist in Node.  I don't know what the answer to this and it will be interesting to see what they cook up.  FWIW there are a couple DOM implementations that run on Node, but what I recall is server side Mojits instead using templates.
Yahoo! Manhattan extends Node.JS to provide the necessary fault-isolation and fault-tolerance, scalability, availability, security and performance you’d otherwise expect from one of the largest web companies in the world.
That's a very information dense sentence because each word refers to whole areas of expertise which they poured into developing the hosting platform.  This is the team I actually worked in, and I feel constrained from sharing too much.  Basically what this means is a Mojito developer will not have full access to the entire Node API because of all these reasons.  Additionally the vision is that the Manhattan infrastructure would spin up in a cloud-oriented fashion servers to handle traffic to each Mojit.  Yahoo already has a world class web infrastructure which is providing some of the words mentioned in that sentence.
We will also make Mojito open source through YDN in the first quarter of 2012.
Later in 2012 we will be opening Yahoo! Manhattan for publishers to be able to run Mojito-based applications on Yahoo!’s Cloud.
Be patient ...
I wanted to close with embedding their videos in this blog post and talk about them.  Unfortunately they're not allowing the videos to be embedded - so click on the "Shaken, Not Stirred" link below.
The first video shows Matt Taylor using the "mojito command line tool" to develop an application, then the "ghh" tool to deploy to a Manhattan server.  Note the video doesn't show coding.  The video demonstrates automatically degrading an application from a rich user interface down to buttons on an HTML page depending on the device characteristics.  As mentioned earlier, they're intending to detect device characteristics and tune the user experience based on those characteristics.  This is something Yahoo has years of experience from their mobile applications.
The video also shows the "ghh" tool - it's a command line tool for deploying applications to Manhattan.  I'll be really surprised if ghh is delivered to the public for public use, because it didn't seem in June that ghh would ever be anything but an Yahoo-internal tool.  But plans do have a way of changing as a project matures.  I wonder if this is a video originally meant for internal training, that they trimmed down for this public showing?
The second video talks about solving the fragmentation problem that Yahoo saw.  Yahoo has a long history of preferencing actual Web Standards rather than going for proprietary stuff.  You can see this as a result of not owning the device of any customer hardware, and that therefore Yahoo's success depends on stressing open Web Standards.
A puzzle in the second video is what they mean by an "execution environment" in the browser for running Mojits.  Clearly Node modules aren't directly applicable to a web browser because Node offers a lot of modules and API's that don't exist in browsers.  Node modules are CommonJS modules (more or less) which can execute in a browser so I suppose that as long as your Mojit code doesn't use any Node-specific API's it could execute either on server or client.

Using Node.js and YUI 3 (Dav Glass in September 2010 gushing about YUI running in the server on Node)
Node.js Roadmap (Ryan Dahl presenting the Node roadmap at YUIConf 2010)
Node.js + YUI 3 (Dav Glass at YUIConf 2010)
YUI 3 & Node.js for JavaScript View Rendering on Client or Server Matt Taylor - The promise of Node.js and YUI 3 running server-side is that a new era of frameworks is possible in which view rendering on the client and server is implemented with the same JavaScript-based code.
YUI 3 and Node.js - Not Just For Web Pages (Dav Glass in May 2011)
Yahoo’s ‘Manhattan’ To Rescue Web From the iPad
Yahoo! Announces Cocktails – Shaken, Not Stirred
YUI for Cocktails

No comments:

Post a Comment