You are currently browsing the monthly archive for September 2014.

Answer by Fabrizio Moscon:

This isn't a trivial question so I think it deserves an articulate answer. Few points have been already expressed in other answers but I think listing all of them can help clarity:

1) fast and easy to prototype: makes extremely easy to prototype (almost) any kind of web application in a shorter time when compared with others like for example JAVA and LAMP. Just to mention some of the savings in time: node.js provides the web server module itself, so you don't have to own knowledge about setting up Apache or NGINX unless you want to integrate in the existing platform or you have a complex system architecture, and the very active node.js community provides ready-to-use modules and deep knowledge that can save you time when it comes to develop commodity features (Facebook-Connect, RESTful API, templating)
2) npm: is THE node package manager, it represents the standard way to share code with the community and to manage external dependencies. It is only 2 years old and the number of module present has (almost) overcome the number of module published on RoR gems. Using community modules like express, socket.io, mongoose, mocha, everyauth – just to mention few of them – provide you with a powerful toolbox to build a running application "LAMP equivalent" within a matter of hours. It manages all the nested dependencies for you, so you can concentrate to what is your CORE application logic rather than spending time developing commodity features which the community is maintaining in a collaborative and effective way for you. The easy configuration file syntax let you also fix a module to a specific version so you don't have to worry about future updates breaking your software.
3) cloud platform: there are a number of Platform as a service solution like Joyent cloud, heroku, nodejitsu which identify node as first class technology and make deploy and scale of your application trivial. Other similar services like Pagoda let you develop PHP+MySQL application easily as well, but at the moment there is more choice and better support for node technologies in the cloud IMHO.
4) mongoDB and Redis: usually a node.js project comes hand in hand with a NoSQL solution. MongoDB and Redis are complementary technologies that are very well integrated with node.js. If you are doing a project without a relational database, node.js is definitely a good candidate.
5) javascript and coffescript: the fact that Javascript is the language of the browser made it necessary for all web developers to deal with it. This means that almost every developer can read Javascript, and I find more and more people capable of writing good, solid, robust client JavaScript applications. Having node.js in the backend brings other kind of problems like layered architecture, Domain Model Design, MVC and correct use of design patterns which developers are typically used to solve using other languages like PHP, JAVA, Python, RoR, but coffescript constitutes a valid bridging gap translator language between the clssical OO inheritance and prototypal ones like JavaScript, helping not savvy new re-discovered node.js developers to avoid silly mistakes and filtering out the bad part of JavaScript
6) architecture: node.js architecture helps you overcome performance and scalability problems thanks to its non-blocking interaction. Metaphorically someone at the Nodestack on-line conference compared Apache as a pizza over when you have to wait for the existing pizzas to be cooked before putting more in and node.js to a juggler which let requests to be handled in the air while is serving the new coming. This particular architecture that similarly to NGINX leverage directly the Operating System event system calls opens up the development of all those soft real-time application which couldn't be developed easily using other languages. 
7) costs: thanks to its high performance you can avoid costs for extra hardware. I manage to reach 5000 response per second on my laptop (measuring with ab -n 100000 -c an express application). Theoretically you also save in system administration time (unless you have a complex architecture), since there is no need to bridge HTTP or TCP requests to another server side language. So you avoid Apache or NGINX setup and maintenance costs.

There are still a branch of web applications that I would not advise being developed using node.js, although the community is growing so quickly that I wouldn't be surprise to see very soon node.js used at the centre of complex transactional systems. Most probably when you need a sandbox environment where separation of memory space for each requests is critical for the business and you can't afford a situation where a single exception takes down the server node.js is suboptimal.

Why choose Node.js for web applications?

Advertisements
%d bloggers like this: