NodeJS: Pros and Cons !!

NodeJS: Pros and Cons !!

According to nodejs.org (official website) it is "A platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications". Core part of Node.JS is Google's powerful V8 JavaScript engine which powers Chrome browser, hence the performance.

To start with Node.js is a very powerful technology. It provides speed, flexibility, and more importantly it's all in JavaScript. It’s also being used by a lot of people and some of the largest companies out there. The community is growing at insanely fast rate. 

But as the Spiderman says "With great power comes, great responsibility", one has to make a rational decision around following

"When should NodeJS be used?"

"What should NodeJS be used for?" 

These are all valid questions, which I will try to answer here. 

When to use NodeJS:

Node.JS is built on excellent non-blocking event driven architecture model, so if your project/module can really benefit for this model this definitely go for it. Some of the use cases can be:

  • Build APIs –
    • mobile apps can benefit most out of it since they consume data mostly via web services in form of JSON APIs
    • It's perfect for handling lots of requests that are I/O driven (e.g. operations on database) and scales very nicely
  • Real time web applications –
    • Anything which requires real-time feedback from web server (chat application, messaging apps or other collaboration tools etc.)
    • Node will be the best technology for this type of job. Ruby and Python can both do these kind of features however Node.js will do it exceptionally well in terms of performance and ease of development
  • Single page applications (Web applications in AJAX, Mobile Web applications etc.) –
    • Node has ability to process many requests with low response times
    • Also has ability to share things like validations between client and server side, which makes it a great choice for modern web applications that do lots of process on client side
  • Streaming Data –
    • If you plan to build streaming applications then NodeJS is what you are looking for!!
    • Traditional web technologies often treat http requests and responses as atomic events. However, the truth is that they are streams and not events. And hence many cool node.js applications can be built to take advantage of this fact

 

When not to use NodeJS:

Even though I love node.js, there are several use cases where it simply doesn't make sense. Following are the few use cases:

  • Heavy CPU Utilizing applications –
    • Never use Node for applications that are very heavy on CPU usage and very light on actual I/O.
    • Hence if you plan to write video encoding software, image processing, artificial intelligence or similar CPU hungry software, please do not use node.js.
    • Node allows you to easily write C++ add-ons, so you could certainly use it as a scripting engine on top of your super-secret algorithms. 
  • Simple CRUD / HTML applications –
    • While node will eventually be a fun tool for writing all kinds of web applications, however your app will not magically get more traffic just because you write it in node
    • So if most of your application is simply rendering HTML based on some database, using node will not provide many tangible business benefits yet.
    • So there are no tangible benefits over PHP, JAVA or DJANGO, hence better choose tried and tested frameworks 
  • NoSQL + Node + the Hype –
    • If you're already taking a technological risk with using node, you shouldn't multiply it with more technology you probably don't fully understand yet
    • So no matter how tempting MongoDB, CouchDB or Cassandra might be, remember “so did the red apple to Eve”
    • So only choose when there’s a real use case to use Node 
  • Enterprise applications –
    • If you plan to build an enterprise application which requires complex operations stick to proven technologies like JAVA, Python so on
    • Node still has a long way to go and is considered to be young technology and yet to prove its metal 

要查看或添加评论,请登录

Piyush Baheti的更多文章

社区洞察

其他会员也浏览了