Learning Node.js |
Author: Marc Wandschneider
Node.js is still a hot topic and this book promises to show you how to build web apps using it. Node.js is an interesting idea - use JavaScript to build the server side as well as the client side of your application. It is controversial because it advocates the use of event driven programming using a single thread. This is potentially more efficient but it is also a return to the days of co-operative multi-tasking. What is worse is that instead of having a nice configurable web server you have to program the whole thing yourself using JavaScript objects and their methods. Even so the benefits of using JavaScript at both ends of the connection are very attractive.
This book is an introduction to using Node.js and it starts off, in Part I: Learning to Walk, with how to install it on Mac, Windows and Linux. It then takes you through a simple "Hello World" example and then starts to explain about debugging. For me this is the wrong order, debugging and other features can be left until I have a grasp on what is in Node.js - but you might not agree. Chapter 2 is a very short guide to JavaScript and if you need to read it you probably aren't going to be doing much with Node.js. The introduction is inadequate even as an introduction to a programming familiar with another language. In fact, because it doesn't stress the differences between JavaScript and a traditional class-based language, it is probably worse than useless. Next we have a look at asynchronous programming. Of course if you are an experienced web programmer you will already be accustomed to the idea of asynchronous programming. The chapter does explain that you have to be careful not to hog the system and write short callbacks, but it doesn't really explain what to do if you need to implement a worker service. It also starts an example that is used and extended as the book progresses. If you like books that develop big examples, rather than telling you about principles, then this might be for you. The only downside is that there are a few typos in the code.
Part II: Learning to Run starts off with a chapter on creating a simple JSON server. Chapter 5 is about creating modules and the final chapter of the section is on expanding the example using the Mustache templating system. Part III: Writing Web Applications deals wtith the Express framework for Node.js. Chapter 8 is about using MongoDB, and Chapter 9 is about using MySQL. The final part of the book is on Getting the most out of Node.js and it has chapters covering deployment and development; command line programming; and testing. This isn't a book that goes deep into Node.js. It doesn't really give you an idea of what the overall architecture of a big application should be like. It does cover the idea of running multiple copies of Node.js and implementing a proxy with a round robin queue to share out the work, but this is about as far as it goes. It does mention using the Child Process to run other applications, but in just a page or so, and it does deal with the problem of scaling using a central store for session data, but these are just sketches for you fill out in the real world. In the real world, there are lots of questions about the practicality of using Node.js and this issue isn't covered. Also, while you do see plenty of code, you don't get an overall feeling of what is in Node.js and what you can do with it. So, for example, it covers the HTTP object and briefly the HTTPS object, but it ignores the UDP object. This is perhaps reasonable for an introduction to Node.js, but you do need to realize that at the end of reading this book there is a lot of Node.js you simply won't know anything about. If you are looking for a book that shows you how to Node.js works by building an example web application then this might be the book for you. If you are looking for a comprehensive and logical coverage of Node.js then you need a different book.
|
|||
Last Updated ( Wednesday, 27 November 2013 ) |