Main Content

Why JavaScript is the New Black; An Introduction to Node.js

About the Talk

September 28, 2010 6:05 AM

New York

New York

ode.js is a highly concurrent JavaScript server written on top of the V8 JavaScript runtime. This is awesome for a number of reasons. Firstly Node.js has re-architected some of the core module of V8 to create a server implementation that is non-blocking (similar to other event driven frameworks like Twisted). Event driven architectures are a natural fit for JavaScript developers because it’s already how the browser works. By using an event driven framework Node is not only intuitive to use but also highly scalable. Tests have shown Node instances running tens of thousands of simultaneous users.

This session will explore the architectural basics of Node.js and how it’s different from blocking server implementations such as PHP, Rail or Java Servlets. We’ll explore some basic examples of creating a simple server, dealing with HTTP requests, etc.

The bigger question is once we have this awesome programming environment, what do we do with it? Node already has a really vibrant collection of modules which provide a range of functionality. Demystifying what’s available is pretty important to actually getting stuff done with Node. Since Node itself is very low level, lot’s of things people expect in web servers aren’t automatically there (for example, request routing). In order to help ease people into using Node this session will look at a range of the best modules for Node.js.

There are many approaches to programming in this environment, from Rails and Django clones, to alternative models that even throw away MVC. One of the most interesting is the work from the YUI (Yahoo! User Interface) team in porting the YUI3 library to Node.js. By having the client side library able to run on Node with a full DOM we can render the same widgets we render on the client on the server, with the same code! This is a really big step. By being able to use the same code on both the client and the server we get two really important benefits:

We get huge code re-use We make the page much faster by pre-rendering on the server The benefits of code re-use are really obvious. We get to write less code and use it in more places. The performance benefits are less obvious. It was always possible to pre-render the correct markup and state for complex interactive widgets on the server, however maintaining two implementations of widgets was prohibitively expensive. Now that we can run the same code on both the client and the server it’s possible to massively reduce the amount of processing and rendering work the client has to do by sending pre-rendered pages, or pieces of pages.

This approach gives us huge flexibility. We are able to send high bandwidth users an incredibly interactive experience that is largely client driven but is still able to draw on server-side components drawn and loaded dynamically. However in more constrained environments we can draw everything on the server and send finished pages to the client. This is ideal for providing a united platform to handle both web and mobile web.

Participants in this session will learn:

How to get started with Node.js Which modules are important and how to pick the ones for them How YUI3 on Node.js implements a shared client/server library to gain coding and performance gains Participants should have a good understanding of JavaScript and be familiar with web development to make the most of this talk.

Ratings and Recommendations

This Talk hasn't been rated yet. Sign In to rate Talks.

comments powered by Disqus