5 Reasons To Learn Node.js in 2019
Node.js came out in 2009 and it has been 10 years already. There has been lots of languages and frameworks and there will be in the future. Hipster engineers prefer newer and cooler stuffs. However, there are still strong reasons to learn Node.js in 2019.
Strong Concurrency
Node.js known for high IO performance. You don’t have to create a new thread per request. All the proper written non-blocking code will be fairly efficiently managed by its JavaScript engine, V8, event loop.
No Context Switch for Dev
For web development, you need to develop both backend and frontend. In frontend, there would be no real choice other than HTML, CSS and JavaScript. However, backend can be written with many different language of your choice. Since you can write codes with JavaScript in both frontend and backend, you don’t have to be confused by some syntax differences and switching data types. Reusing validation code is a good example of sharing codes between both sides.
Ecosystem
Node.js has enthuasiastic and large ecosystem. There are more than 1 million packages. You can easily find what you want in npm package registry.
When you have some hardship using those or found some bugs, you can go to the library’s github issue page and ask questions on it. Also you can be part of the library by contributing those packages, too. You can easily create a npm package. See an official guide here.
Native Modules
Node.js run on V8, Google Chrome’s JavaScript engine, and it is very fast.
Strong Concurrency != High Performance
Of course, C/C++ beats Node.js on heavy computation tasks. Node.js supports native modules, which allows Node.js to import written in C/C++ and also some other languages like Go and Rust. So Node.js can be benefited from performance sensitive code parts. Usually many networking libraries, complex calculation util libraries and database drivers come with native modules. When you see node-gyp
in a npm package’s repo, it is an indicate that it is a native module.
No More Callback Hell
Working on Node.js has been known for dealing with callback hell. It can be still done with multiple plain callbacks. Async.js
library was the popular one before Promise
came out. Since Promise concept is widely adapted, it has become the most popular one. Along with the Promise
, new async, await
syntax give even more ease for developers with better code readability.
See how the latest async, await
resolves the callback hell problem nicely.
Conclusion
It’s not too late to learn Node.js in 2019. Also you don’t have to use 100% Node.js stack for your project. Start a toy project with Node.js and you won’t regret it. Go and try Hello World
now.