- This topic has 0 replies, 1 voice, and was last updated 10 months ago by Chinomnso.
- December 3, 2019 at 11:04 am #81464Participant@chinomnso
In recent years, there have been lots of discussions about Node.js in the software development community. But there seems to be as much confusion about Node.js as there have been discussions. This article explains exactly what Node.js is and why you may want to use it. Please note that I will be using Node and Node.js to refer to the same thing.
So, what exactly is Node.js?
What can you do with Node?
The growing popularity of Node in recent years is surely not without reason. Big companies like Netflix, Uber and Walmart use it. The demand is huge, and it’s steadily on the rise. Front end developers use it to compile their applications and back-end engineers use it for the business logic of their applications.
Node’s model is an event-driven, non-blocking I/O model that ensures it is lightweight and really efficient. In case you do not know, I/O is something applications do all of the time: input/output. This could be a database read and write request, or it could be writing to a file or reading from it. It could even be making a request to an API on another server. The truth is that I/O takes time.
The non-blocking I/O model is great because one process would not block another. This means that when one user is requesting a URL, a file or any other resource, other users can be making requests for those same resources concurrently without any of them hindering or “blocking” the delivery of the other.
Blocking I/O system calls do not return until the I/O process is complete. In non-blocking I/O system calls, the reverse is the case. The system call returns once it is made, then the process is notified once the call is complete. To illustrate this, imagine you want to boil rice and your room needs to be cleaned. Putting the rice in the cooker and waiting for it to be cooked, doing nothing, is similar to the blocking system. But leaving it in the cooker and cleaning your room, then taking it off the cooker when it is cooked is illustrative of the non-blocking system.
According to Nodejs.org, Node’s package ecosystem, “npm is the largest ecosystem of open source libraries in the world”. This means that it has a huge community around it with volunteers developing libraries that carry out everyday programming tasks including serving up real-time data using sockets, creating servers and validating objects.
This means that you can really focus on creating your application and writing real code without having to bother about building the software infrastructure that supports it. If you’re trying to build something that is somewhat generic, you will likely find a solution in npm that has been built by someone else. So, suppose you want to validate an object, you can simply google “npm validate object” and you will see lots of results for that. You can simply download or install the package, tweak to align with the specifics of your project, and you’re ready to run.
I have pointed out that you may want to use Node because of its speed which is made possible by its non-blocking model. Another advantage of Node is its package ecosystem, which provides solutions to many common programming tasks. Node.js sure has its advantages over other technologies, just as other technologies and languages have theirs over Node.
In the area of web technologies, one of Node’s biggest rivals is PHP. Read this article to see why PHP is not going away anytime soon.
- You must be logged in to reply to this topic.