Node.js — Learning!
As technology keeps changing, its always trend for the developers to learn the new ones and adapted to those and survive in that stream. I am beginner in programming and when i try to look for job there is always one flashy word Node.js .. so i wanted to dig more and find out what is node.js.
i don`t want to go on with introduction of who build it and when was it build. Lets go own to the main point why was it developed?. what makes it so special than other?.and where node can be used!.
“Node.js is real-time web application employing push technology over web-sockets”
What is Node.js?
- Node is server side platform wrapped around javascript language.
- Node is not written in Javascript its actually written in c++ . Node used the Javascript as interpretive language for the server-side request and response processing.
- so Node is standalone javascript program.
- Node is designed to work with interactivity smaller chunk of data responding to many events rather than one larger chunk of data sent at once for processing.
Node helps in having two-way connection between the server and client.that means either server or the client (browser) can initiate the communication between them and allow to exchange data freely.
Node is platform independent. “Node is non-blocking,event driven I/O,light weighted and efficient in the face of data- intensive real time applications that run across distributed devices.”
What is light weighted means?
well here is a small example which made me to understand better from techopedia:
“Imagine you are shipping a small package by FedEx and you note all the “containers” your package travels in on its way to the destination. There would be a truck that carries all the packages to a local processing center. There would be large bins at this center that are forklifted over to the airplane shipping containers that are used to transport to the destination center. And once the package arrives, the reverse takes place with other packages going in the opposite direction.
All this packaging and repackaging is a laborious and expensive process and is exactly what the current programming technologies like JSON and REST do to move data over the Internet. Node.js cuts this repackaging down considerably and provides a lightweight means of accomplishing the same task.”
Node.js is used in building fast, scalable network application.
How Node works?
Node operates on single Thread, using non-blocking I/O calls.but there is always pitfall in single thread operation such as
- The thread is blocked until the task is completed. so other incoming request has to wait till the computation completes.
.. to be continued.
Credits to:
1. https://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js