Why’s Node.js so popular?
We won’t be talking about all the advantages and other cool stuff JS can provide, hence it is not the topic. The thing is that the possibilities that are now available with JS server-browser communications were hardly imaginable several years ago. I mean sure, there were some things of that sort, yet they were locked in sandbox environments such as Flash or, let’s say Java Applets for example.
So what is Node.JS? It is basically a package compilation of the V 8 JS Engine from Google with the abstraction layer of the libuv platform as well as a core library that is written in JS. So we can see that Rayan Dahl (the Node.JS creator) was originally aiming for creating a real-time website with the push capability. Thus, Gmail alike services inspired Rayan so has provided us with a nice tool for working in the non-blocking and event-driven I/O paradigm. If we put all that into a single sentence we will get something like: Node.JS is employing push tech over websockets.
Node.JS may provide us with some unique benefits as well as some pitfalls. So let’s get to ‘why use it in the first place’ part.
Examples of advantages
What Node.JS does is that it uses non-blocking I/O that is in addition event-driven to remain light of weight and efficient in the cruel world of data-intensive real time apps that are running across distributed devices. Thus we get the understanding of the fact Node.JS is not a platform that will dominate over others. It is just good for precise operations, not more, not less. Note: never, hear me? Never do you want to use it for CPU-intensive operations. Usage of Node.JS is in fact destroying all the advantages of heavy computation whatsoever. But we’ll get to the minuses later.
What Node.JS is good for is the process of building fast and scalable network apps. Node is great with managing lots of rapid, simultaneous connections with a very high throughput. The interesting part is how it actually is working under-the-hood. It is operating but a single thread and is using non-blocking I/O calls. This approach allows the support of dozens of thousands concurrent connections.
Thus you’d want to use it in:
- Chat. A chat is but the most typical real-time multi-user application.
- API on top of the objective DB.
- Queued inputs.
- Data streaming.
Examples of disadvantages
- Server-Side web apps. Yes Node can be used here. And it will have some plusses as well, yet the disadvantages are overweighting. IMHO. If we will even forget that it will require rendered HTML and that is not the most typical way of using Node. There are such pitfalls as, primo, any compilation that will be too intensive on CPU (and there may be lots of them) will be blocking the responsiveness of Node.JS. Thus a threaded platform would be my pick here. Secundo, it is such a pain to use Node with any relational database. So going Rails or ASP.Net will be such a relief in this scenario. Don’t be masochistic.
- Heavy server-side computation and/or processing. Basically any operation that is intensive on CPU destroys all the advantages on Node. All the incoming requests are only getting blocked because your thread is busy number-crunching.
So let’s get to your primary question and look around for some decent literature as well as other available informational sources.
Let’s begin with books, shall we? Books are my primary weapon of choice when I want to learn something. Sure there are all those videos on YouTube or whatever, yet I find them as a pleasant addition rather than the primary source of knowledge.
Let’s start with some beginner-friendly literature rather than going full-time hardcore from the beginning.
- Mastering Node by TJ Holowaychuk. I have actually enjoyed reading it like A LOT some time ago. Despite the fact that it was a side project of the author that was busy with various other projects it came out splendid (yet not too finished). Yet such an approach has its benefits. Everybody has a chance of adding new things to it thus sharing ideas, tricks and simply going crazy. Go for it and you won’t regret it. It is a 100% open source eBook.
- The Node Beginner Book by Manuel Keissling may be just the thing you are looking for. It’s amazingly written and is going way beyond the basic ‘Hello World!’ tutorials. You will learn Node.JS as well as all the related ‘advanced’ Java Script along the way. You actually may be developing your own apps before even finishing reading it.
- Node: Up and Running I personally have never read this piece of work by Tom Hughes-Croucher and Mike Wilson yet all the reviews I’ve heard were splendid. People that’ve read it have enjoyed it very much, thus I take the responsibility of recommending it.
- Professional Node.js by Pedro Tiexeira will get you deeper into the development as well as testing. The book deceivingly begins with the general overview of Node.JS yet you won’t even notice when it got so deep into the core concepts, code, API, debugging, unit testing and flow-control. This one is hardly for JS beginners. You will need to be on good terms with basic Java Script in order to get full benefit from reading this book.
- Instant Node.js Starter from the mentioned above Pedro Tiexeira might just do the trick for you as well. It is also written for people with some knowledge of JS and are willing to learn Node in a rapid way. This one is great for people with some basis of network and event-driven programming behind their back. This work may get you started in no time whatsoever. And it is actually interesting to read rather than just dry text and code pieces.
- Node.js Recipes by Cory Gackenheimer is something you may consider reading when you are done with theory ad are up for practice. The book is written in a ‘problem description – solution’ format. Pretty much all the average issues that you may find during daily-basis working are described in this piece of work. Thus the book may be of great value to you when you are making your first steps of practical usage of Node.JS.
I absolutely love the LearnCode.academy channel on YouTube. There are lots and more various tutorials for web designers and developers there from Will Stern. Most of them are made in a good, easy to understand way.
There is also a splendid tutorial I’ve enjoyed from Ryan Dahl. He makes a splendid first acquaintance for you and Node.JS. Highly informative and well given.
In the present world of availability of information on the Internet blogs may be perfect solutions for those who wish to study and improve their skills. Thus I did my best in order to find the blogs you might find interesting to read.
- Felix’s Node.js Guide Is an extremely useful blog for your purposes. I truly believe you might find all the required tips and tricks there.
- Modulus Is also amongst the top resources I’d suggest you to read.
- How To Node Also has several aces up its sleeve. It would be my personal choice hence I’ve loved how things are written there.
- QArea blog is of a different field, It’s just something I love to read and write for, thus you can take a peak there as well. It’s about IT in general, thus I think you will find something to your liking here.