The Pros and Cons of Node.js for Application Development

Thu 31 July 2014 Written by Evi
Evi

Node.js is the hot property of application development at the moment, and it’s been quickly adopted by some of the biggest names in the industry (including Microsoft and Yahoo!). Why? It’s all about “real-time” applications and “highly-scalable” functionality. If you’re considering moving your application to Node.js – here’s what you really need to know.

Mobile Changed the Game

The web has moved from a consumptive model to an interactive one. This is thanks to mobile internet and the ability to talk, chat, cooperate, etc. constantly - even when we’re on the move. To cope with that change we need a way to redefine applications that reduces the HTTP load on servers. HTTP requests and responses are too heavy for massive server-side use by millions of simultaneously connected users.

Node.js is the Solution?

It’s certainly part of the solution. Node.js is server-side JavaScript execution environment that is event-driven. It utilizes the V8 engine (used by Google in Chrome), which turns JavaScript into machine code. That’s much faster to execute than using an interpreter or running it as bytecode.

And, that’s pretty handy since many developers already know JavaScript and thus Node.js doesn’t require learning a language from scratch but is rather an extension of an easily available skill set.

Event Loops in Node.js

Node.js has a secret weapon too. It uses an event loop to reduce the awkward (and inefficient) process of executing asynchronous I/O operations. In particular, it drops the memory requirements for this for large numbers of calls dramatically. The event loop is responsible for executing an asynchronous task and then passing back the result – it also handles this by executing each task in the most efficient order.

That means developers working with Node.js can build a complex application that can easily handle the needs of millions of users. The event loop does the hard work and the application dealing with client requests – doesn’t have to.

Community

Node.js is open source and that means there are a bundle of useful modules already created by the Node.js community for you to use.

The Downsides of Node.js

Node.js is new, and that means there are still some awkward moments for it. It’s almost certainly going to be THE preferred language of web application development in the near future. However, right now you might want to think about:

  • The Node API: There have been a few issues regarding API stability. These are getting more stable as releases progress but it’s worth noting that not every API change has been compatible with previous releases.
  • The Node.js Libraries: There’s a shortage of standard libraries for JavaScript in general. This may improve as things move forward - or it may not - but that may mean more work for your application development team too.
  • The “newness” of Node.js: Nobody knows where the “pain points” of working with large scale Node.js applications lie at the moment. You’re going to have to keep a careful eye on security, performance and maintenance issues for a while until the language has been more thoroughly road tested.

Summary

Node.js is the web application development language of the future - too many big names have already committed to it for that not to be true. There are some real advantages of using the language, and as long as you pay careful attention to the (minor) downsides of using Node.js – it’s probably time to start preparing for using Node.js in your application development.