Introduction

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It is one of the most popular platform for building web server applications.

I use Node.js at work, and find it is very powerful. The Nodejs community is vibrant and growing. JavaScript, despite its oddities can be a great language to code in. And you will daily rethink your own understanding of "best practice" and the patterns of well-structured code.

There's an enormous energy of ideas flowing into Node.js right now

Advantages of Node.js

Here are some advantages about Node.js:

  • Web development in a dynamic language (JavaScript) on a VM that is incredibly fast (V8). It is faster than Ruby, Python, or Perl.
  • Ability to handle thousands of concurrent connections with minimal overhead on a single process.
  • JavaScript is perfect for event loops with first class function objects and closures. People already know how to use it this way having used it in the browser to respond to user initiated events.
  • A lot of people already know JavaScript, even people who do not claim to be programmers. It is arguably the most popular programming language.
  • Using JavaScript on a web server as well as the browser reduces the impedance mismatch between the two programming environments which can communicate data structures via JSON that work the same on both sides of the equation. Duplicate form validation code can be shared between server and client, etc.

Disadvantages of Node.js

Here are some disadvantages about Node.js:

  • Callback Hell: Everything is asynchronous by default. This means you are likely to end up using tons of nested callbacks. Nevertheless, there are a number of solutions to this problem, e.g. caolan/async or Understanding promises in node.js . This problem is specific to JavaScript, not Node.JS.
  • Single-threaded: Node.js is single-threaded. You can take advantage of multiple CPUs, but in general everything is designed to use the Event-Loop in order to achieve extraordinary performance. This can also be an advantage, since e.g write conflicts on files aren’t that relevant.
  • JavaScript: I really like JS, but there are some obvious drawbacks (But every programming language sucks, just read YourLanguageSucks - Theory.org Wiki).
  • Event Loop: The Event Loop is the core of Node.js and it’s a genius idea. But, Don’t use Node.js for blocking, CPU-intensive tasks. Node.js is not suited for stuff like that. Node.js is suited for I/O stuff (like web servers).

TL;DR

  • Don’t use Node.js for CPU-intensive tasks.
  • Node.js rocks for servers.
  • JavaScript partly sucks. Use CoffeeScript in order to solve this problem.

References & Resources