I have recently started dabbling with Node.js. A local meetup I stumbled across called stack kitchen is to blame for this dabbling:
Being a lazy Google-user, I did not make it far down the list of results (or even try a very specific search) and used this tutorial.
About halfway through, I realised that the site was actually plugging a book – so I bought the book and worked through the rest of the book.
There are of course lots of other tutorials to choose from out there – probably because node is the flavour of the month (or given how hip I am the flavour of last month…).
Other tutorials and node resources are for example:
This focusses on node as a script host, not so much on the typical use case as a web server.
I liked that it gets you started quite quickly and also mentions some important main features (interactive shell, packager manager, modules, callbacks). A good quick start guide if you want to start hacking things together.
This is more of a blog than a tutorial. It covers lots of different stuff. Probably not a place to come back to later, but not for finding your feet.
Felix (much like Tim who is man behind “How to Node”) is one of the early contributors to node. This website is really several guides in one: a tutorial to get you started, a guide on the community, a style guide and a guide on how to convince your boss (aka when to use node).
(This list was compiled on the couch on a lazy Saturday morning. So… let me know about other cool Node resources!)
How do you choose between those and this book?
If you’re like me, you’ll just take a chance on the first one you stumble across, but “The Node Beginner” book might be for if you…
- …are interested in using node on the web server
Almost all of the book (apart from the initial hello world example) is organised around a couple of (toy-like) web server use cases. There is e.g. no mention of using the node shell or script / parsing like examples.
…are interested in different components of a web server and how they hang together
The separation in to different modules such as the server, the router, the request handlers and view generation was one of the parts I enjoyed the most. While this is well covered, familiar ground (Skonnard e.g. covers similar handling and routing for WCF RESTful web services here), there was very much a beautiful simplicity to the toy implementation here.
…like a blog post writing style
Writer’s style obviously comes down to personal preference, but I really like the style of the book. While sometimes a little long-winded, things are explained in a clear and logical way. Steps are laid like the thought process of somebody developing their first node application. For me this kind of approach fits very well.
Beyond this (and in the interest of adding yet more bullet points), there were some particularly interesting insights here for me:
…how strikingly easy it was to set up a simple server
- …how you then still need to hack your server components together
There was a fair amount of reinventing the wheel in the book. However, to appreciate how much you need to really reinvent the wheel and how much was just a teaching device, I really need to dig a little deeper into existing node packages. Initial impressions are that there are loads and loads of packages.
… execution model
This is one of the things I really still need to get my head around. I get the basic description in the tutorial of the importance of non-blocking operation and a single threaded event loop ….but… I really need to understand this a little better, e.g. how things are executed asynchronously. This seems like quite a good place to start – contrasting node with IIS&WCF.
…the ease of use of package managers
I know this is the order of the day for almost any programming language out there now, but for C++ devs, this is still a big leap. I know Microsoft has expanded NuGet for native use, but because of C++’s reach across different compilers I’m a little sceptical of the widespread adoption of this.
For me, the next stop on the road of learning of node is “Hands on: Nodes.JS” by Pedro Teixeira.
This book comes bundled with the “Node Beginner Book”. Having read some of the first chapter (and glanced through the table of contents), this feels much more like a “grown-up” book. Lots of references to different patterns etc.
The plan is to also start building some breakable toys in Node. (Can you tell I’ve been reading a book about Apprenticeship patterns?). Those toys might make a good first use for my blog github repo.