90 days of node.js - Days 5 and 6

Days 5 and 6 have not been fun. For one thing, they ended up being almost 3 days apart from each other becos of personal sadness :( For another, I just don't grok the stream adventure format.

Node's main purpose is to circumvent the issue of I/O bound calls and instead provide a event mechanism to handle blocking calls. Java NIO solves similar problems, but in a more multi-threaded environment. JavaScripts single threaded model implies Node is restricted by that. ( It also uses something called libuv to handle the OS calls - I'll probably punt on that for now.) To handle all this magic, node uses streams - effectively pipes that can be readable, writable or both. You write data to a stream and somehow it can get consumed when piped to another writeable stream and so on. This is at the heart of the evented I/O mechanism making streams pretty much the most importatn thing to grok as soon as possible.

Hence enter stream-adventure. The positives are there. It made me sift through a lot of documentation in a short time. It also made me more familiar with through and through2 - excellent modules imo. But this choice in modules lies in the heart of why I think stream-adventure failed for me. I kept getting lost in the forest of sketchily documented modules. Each module makes sense once I could see the final code, but to get it working was a pain. I ended up cribing code from stack overflow and the github forums (Thanks jeremy-w for your stream-adventure solutions) . Not my finest, but I didn't want to get stuck forever in a rut without progressing further. I am still not a 100% on board with what modules exist and how I can use them to fashion my own streams, but I know through now and that will be useful.

The next thing to tackle is how to use npm. I've been using it without understanding what it *really* does, so the next project is how-to-npm.

Avaunt, Excelsior and so on.

No comments:

Post a Comment