Friday, November 4, 2011

Do front-end engineers using Node.js win if they can use familiar frameworks even on the server?

Node (a.k.a. Node.js), because it's an excellent server side javascript platform, makes it possible for "front end engineers" who normally code javascript in web pages, to now do stuff on the server side.  Dav Glass, a YUI engineer, gave a presentation at Yahoo's F2E (Front End Engineers) conference about using YUI3 on Node to make Node into a convenient familiar environment for front end engineers.

The video is available through the YUI Library website (see link below).  At the time I viewed the page it refused to let me play it in my browser, but I could download the .mp4 file (over a gigabyte!) and view it using QuickTime.  YMMV

The argument, that front-end engineers will find YUI3+Node comfortable, fits neatly with the observation I made yesterday (http://nodejs.davidherron.com/2011/11/yahoo-reveals-their-nodejs-mojito.html) about the long-standing dream of the same code running on server and client.  Dav's argument is that someone familiar with YUI3 in a browser will be instantly comfortable with YUI3 on Node.  And he proceeded to go through several code samples to demonstrate this argument.

Unfortunately the camera angle was not such that we could read the code samples.  Instead you'll have to just get the gist of it from how he presented the ideas, plus you can download his code from http://github.com/davglass.

A detail which sticks out right away is that YUI has its own module system, its own system for resolving dependencies and loading the correct modules.  Node has the baked in module system, based on the require function, and YUI has its own.  The YUI coder will write Y.use(), at which point YUI will resolve (and load) through its own mechanisms the requested YUI modules.  This may not be a problem but it's an instance of duplication.

What struck me is the potential value in developer knowledge reuse.  As it stands with Node, if you give Node to a front-end engineer their only familiarity will be the language.  They'll be learning a whole new framework, from the Node module architecture to the Node API's to the npm package manager, etc.  It's not like this is tough and there are books available, such as Node Web Development, to help them get up to speed.  But maybe Dav is right, that there's enough value in the familiarity of a familiar toolkit to refactor it for use on Node.

http://yuilibrary.com/theater/davglass/f2esummit2011-glass/

1 comment:

  1. I'd argue that it's irresponsible to port front-end frameworks to node. There are significant incompatibilities with the node way of doing it and they were simply not designed to be run on a server side environment.

    However the concept of code re-use is awesome. The proper solution is to develop a new system for shared code that takes advantage of both node and browser APIs.

    I would also find it irresponsible for a front end developer to dive into node using a front end framework without understanding what node is about or knowing it's APIs. It's simply a easy way to misuse the tool

    ReplyDelete