Why Node.js is Powerful
Taking cues from the official documentation of node, I will explain with four points why it is powerful and better than existing programming languages.
Node.js uses an event-driven, non-blocking I/O model
This is a feature at the core of node’s power. I/o refers to Input/Output, it describes the way computers perform operations with the external world, operations such as reading or writing to a database, HTTP requests etc. The I/O operation is the darling of network applications but have traditionally been ‘blocking’. Blocking languages like PHP or Java did I/O operations in a sequential/synchronous order but Node.js’s I/O operation is event-driven/asynchronous. Essentially node.js does not just run code line by line but when it encounters an operation that could take time, it kickstarts it and goes to the next statements of code while waiting for the operation to be completed whenever it would. A callback is used to state what should happen after such operations have been completed.This makes node faster than other programming languages. More on this in a future post.
A real life illustration of this is how different coffee shops operate. Some shops let customers line up in a single queue and then attend to them one after the other. No customer is attended to until a previous customers drinks have been prepared and served. This is a blocking model and is wasteful because more resources such as waiters will be needed. However, there are other coffee shops that have you say what you want and then you go off to sit and while your order is being prepared, the next customer is attended to. This is a non-blocking I/O. After your coffee has been prepared, it is delivered to you. In this approach, less resources such as employees are needed. In computer, resources would be the CPU power. Node can run on less powerful CPUs while other the blocking approach may require more CPUs.
Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world
Secondly, the community around node.js is the biggest in the world, providing open source packages for almost every programming utility you can think of. This is a great because as a developer, you could take advantage of libraries or plugins that have already been written to build your project.
Originally published at Stellar Code.