Adoption by the Enterprise world
First, Node.js has been adopted by multiple top-tier companies, with great success. Here are a few companies who have adopted Node.js: PayPal, Walmart, Ebay, Groupon, and LinkedIn. And these companies are not using Node for menial tasks; they’re using it in heavily-used production applications. For example, PayPal wrote about their experience using Node.js on what they call "one of the most trafficked apps on the website”. Here are some of their observations comparing their Node.js version of the app to their Java version of the app:
- Built almost twice as fast with fewer people
- Written in 33% fewer lines of code
- Constructed with 40% fewer files
- Double the requests per second vs. the Java application
- 35% decrease in the average response time
That’s pretty serious! That’s what got me interested.
Package manager - NPM
So I started looking into Node.js for myself, and found many wonderful things. First, it has a wonderful package management system called npm. With npm, you can install practically any Node.js package/library by running “npm install package-name”. Node.js also has nice conventions for keeping track of dependencies with a package.json file. With this, you can simply clone a Node.js repo, and run “npm install” to install all of the necessary dependencies.
Another thing I loved about Node.js was the REPL (read-evaluate-print loop) - or as it is sometimes called, the Node.js command-line. With this, you can just type “node” in the terminal, and be able to test out Node.js one line at a time. This is something that, coming from a strong Python background, I have come to absolutely love! I can easily write a function, and jump into the REPL, import the code, and test it out. Or I sometimes write the function in the REPL, and once it is working well, copy it to my source code file.
Node.js has another big thing going for it: it was built with an emphasis on non-blocking functions (on the Event loop model), and this emphasis has been adopted by the whole Node.js community. This is why you will see a lot of callbacks and promises in Node.js code. When you call a function in Node.js, if there is any chance it could take a while, that function will not return it’s value directly; instead, it will return immediately, run the long-running operation "in the background", and call the callback function when complete (passing the return value as a parameter to that callback function). This design pattern is what leads to Node.js’s impressive performance record.
Use Node.js! It's fun, easy to learn, and (I'm betting) will continue to gain prominence in the upcoming years.
More comments on Hacker News: https://news.ycombinator.com/item?id=8324890