Newsletters




Node.js Brings JavaScript to the Server


Bookmark and Share

Redmonk’s annual programming language rankings – based on GitHub and StackOverflow traffic – were recently released and to no one’s surprise, JavaScript was ranked as the most popular programming language.  

The popularity of JavaScript is reflective of its critical role in powering modern web-based applications.  The rich experience that characterizes the modern web has largely been enabled  by the shift from HTML-centric web applications in web 1.0 to the web 2.0-style in which key presentation logic is implemented in JavaScript. 

JavaScript in the browser is typically coupled with Java, C#, or some other language in the middle tier.  However, the appeal of using a single language to implement all application logic is compelling and this is where Node.js offers a powerful solution.

Put simply, Node.js is a JavaScript implementation that can run outside the web browser.  More precisely, Node.js is an event driven, non-blocking I/O framework built on Google Chrome’s impressively fast V8 JavaScript engine.

Initially released in 2009, Node.js was designed to ease the process of developing scalable distributed applications with streaming and low latency in mind. It is asynchronous, allowing modules written in JavaScript to perform other tasks while awaiting responses from users or web services. 

Node.js opens up distributed web application development to a wider audience. Many professionals that wouldn't consider themselves programmers - such as web designers – know a little JavaScript.  Its popularity is increased further by its synergy with browser and certain database technologies.  The “MEAN” (MongoDB-Express-AngularJS-Node) stack, exploits the MongoDB database’s Javascript interface, the Angular Javascript presentation framework and Node to create a coherent software development stack using JavaScript as the glue.

A key part of the Node.js success story has been its use of NPM, its package manager.  As we’ve seen in other contexts, the existence of a vibrant and open extensions marketplace helps fuel functionality in the platform and loyalty and enthusiasm amongst the community.  At time of writing, NPM provides over 250,000 modules for use and this number continues to grow.  NPM is also used by other JavaScript frameworks such as AngularJs, IO.Js and JQuery. The NPM website (npmjs.com) boasts over 3 billion downloads in the last month, demonstrating how integral it is to JavaScript development in the modern community.

One of the key technical characteristics of Node.Js is it’s avoidance of the standard threaded concurrency model.  Many developers consider traditional thread-based networking to be inefficient, error prone and difficult to correctly code.  In a traditional programming model, a program will block until the request completes.  In Node’s event based model, the application can continue to perform other processing and then respond to an event when the request completes. This allows Node developers to avoid having to handle “deadlocking," which can occur when two threads are each waiting on the other.  Since the threads do not block, deadlocks will not normally occur.  

Node has clearly been designed as a framework that developers new and old can pick up easily and quickly. With its massive collection of packages just a single command away using NPM, it is highly extensible.  The non-blocking architecture and performance design provides a highly scalable architecture. These factors, together with the synergy with client-side JavaScript make it easy to see why Node.js has grown so quickly in the last decade - notable users of Node.Js include Netflix, LinkedIn and Microsoft.  

As a language JavaScript is often criticized and even its creators acknowledge that the initial implementation involved compromises and flaws.  However, JavaScript is a language born of the web, and is an almost universal element in modern web applications.  By extending the scope of JavaScript, Node.js empowers JavaScript developers and is therefore an important contribution to web development.


Sponsors