Professional Node.js |
Author: Pedro Teixeira Node.js seems to be growing in importance and we need some good book to tell us what it is all about. Is Professional Node.js the one you need? This is a very strange book. It does cover all of Node.js but it does it in what might appear to be a strange order. It also tends to explain simple things in very academic ways. For example, callbacks are introduced as continuation style passing and simple event handlers are part of the event emitter pattern. None of this is wrong, well callbacks are actually not quite proper continuation style passing, but it isn't particularly helpful. The beginner is just going to be confused and the expert doesn't need it.
The book is divided into six parts and as you might expect Part I deals with the basics of what Node.js is and how to set it up. Oddly, given it's the part about what makes Node.js important, it doesn't mention its approach to building a web or any other type of server. What we have is an introduction to Node.js as if it had invented event driven programming. Of course, most JavaScript programmers coming from the client side will find the event driven approach nothing but natural. Part II is about the core API. It starts with loading and creating modules - which is a strange place to start given we still haven't seen even a modest Node.js example. By this point in the book the presentation has settled down into very small chapters with a short explanation, short example and short summary. It reads more like a manual than a book trying to get you to understand the principles of Node.js. Chapter 5 is about buffers and again this really should have come later in the book. Chapter 6 is about using the event emitter pattern - what most of us would call working with events. I'm not against the idea of introducing academic descriptions but in this case the beginner might be under the impression that something new was being introduced. This part of the book closes with a look at using timers to execute functions asynchronously. Again this isn't something particularly specific to Node.js and may clientside JavaScript programmers are very used to the idea of using setTimeout and setInterval to avoid blocking the event loop.
So we start Part III of the book after 50 pages that haven't really covered much that is specific to Node.js and which certainly have done nothing to give the beginner any idea why they should be interested in using serverside JavaScript. There have lots of assertions that the event driven approach is clearly the best. But for what and where is the proof? Part III begins with a look at working with files, creating and using external processes, reading and writing stream data and finally building a TCP server in Chapter 10. You could take the attitude that Node.js is a completely general implementation of JavaScript, but most users want to get to grips with its use as a network server of some description and leaving it to Chapter 10 to introduce the first example or mention of this aspect seems very late to me. From here we have a set of chapters that introduce HTTP servers,TCP clients, HTTP requests and UDP. The section closes with a look at security - using TLS/SSL and HTTPS. This part of the book should prove useful to the majority of readers. My advice is to skim read the first 80 pages and get to the meat then go back and check anything you need extra. The book still tends to be overly abstract. For example the chapter on making HTPP Requests starts: "HTTP has become a central part of the infrastructure of many private and public services on the Internet. Not only used to serve static content, HTTP have become the preferred way of serving and consuming public facing API calls." Yes all correct, but a bit overly stiff and formal. It is also makes it harder to get the bigger picture. Part IV is about building and debugging modules and applications. We go over testing, debugging and eventually get to using the async library. Then on to Part V on web applications using two libraries - Express.js and Connect. Its final chapter deals with socket.io. Part VI is on connecting to databases with a chapter on each of MySQL, CouchDB and MongoDB. The examples get bigger as the book progresses, but they are still easy enough to follow. Overall this is quite a good book but with a few small flaws. The biggest flaw is the tendency to resort to the academic approach before explaining the simple practical examples. It also manages to avoid getting into the core of Node.js until about 100 pages in - if you don't already know something about Node.js this might be confusing. The book tends to get better as it progresses and gets into more difficult subject matter. This isn't the essential book on Node.js, but it might suit you if you prefer things presented in short chunks and as long as you can see through some of the slightly strange abstract presentations to the practical stuff lurking beneath.
|
|||
Last Updated ( Friday, 14 June 2013 ) |