by Emil Abraham
published on Feb. 18, 2015, 5:44 p.m.
The next was learnyounode. Now this was much more exciting. It dealt with specifically Node.js subjects that made Node.js unique. It covered topics like asynchronous IO, Modularity, and callback functions.
Asynchronous IO is extremely cool. In most languages, when you deal with IO, you are limited to a step by step flow of your program. You cannot move on to the next step until the previous step has finished. But with Node, you provide the stream that reads input with a callback function. When the input has finished reading, the callback function will be called. In the meantime, you can continue on with your program while the input function is running. This is a really powerful feature that I have not explicitly studied in other languages. I think this problem will demonstrate, not only the power of this feature, but also the difficulties that can arise. When you call the read function asynchronously, there is no guarantee as to when the read input will finish. In this specific problem, I have to remember to return the output in the same order that I got the input.
Modularity is another topic that this tutorial touched upon. It is basically how Node.js files can be organized and transported. Node package manager, installs the modules for you. You can create your own modules and carry them around to other Node.js projects that might need it. It is similar to how packages work in Java and to applications in Django. That plug-n-play portability seems to be a common feature in many languages and frameworks.
The third tutorial I glossed over was how-to-npm. This tutorial taught me how to deal with node package manager(npm). I even created a fake package that I "published" to npm's big package database. This is an awesome tutorial that many others are lacking. This provides a step-by-step guide on how to give back to the open-source community.
The final tutorial I dealt with was the most difficult. It was called stream-adventure and oh boy was it an adventure. The steps were not very clear like the other tutorials. It covered many use cases and various modules that dealt with streams in Node.js. Modules like through, concat-stream and stream-combiner. I think this tutorial assumed you had a bit more experience with Node.js than I did. But in the end, I finished it with a lot of help from Google. I think I will learn more as I practice and come across streams in the wild.