Sams Teach Yourself Node.js in 24 Hours

Author: George Ornbo
Publisher: Sams
Pages: 464
ISBN: 978-0672335952
Audience: JavaScript developers
Rating: 3
Reviewer: Ian Elliot

Node.js is still the subject of a lot of hype and you need to know something about it. Is 24 hours enough Node.js?

Node.js is server side JavaScript. It is also odd because in its most basic form it replaces the notion of a web server by a set of low level language facilities. You could describe Node.js as a do-it-yourself web page server, but this is just the start. It also takes an asynchronous approach to the problem; that is, Node.js is single-threaded on the server just as JavaScript is single-threaded on the client. Even if you have no plans to use Node.js is it well worth knowing about. 

 

Banner

 

The first chapter of this book explains what Node.js is all about and getting it installed. Next we look at the node package manager and finding packages - included is the warning that the quality of packages isn't guaranteed. 

Chapter 3, or rather Hour 3 to use the book's terminology since each chapter is designed to require an hour, is where you get to really find out what Node.js is all about. How you will react to this chapter depends very much on what you already know. It starts off with a discussion of what I/O is. This is very low level and more or less aimed at the non-programmer. A bit later on the idea that I/O need asynchronous treatment is introduced and we finally get to the idea that Node.js is event driven. If you are are a JavaScript programmer then you should know most of this. Perhaps the part that you don't know is exactly how web servers deal with the problem by using multiple threads which isn't covered in any depth. The next chapter explains the idea of a callback. Again if you are complete beginner then this will be helpful, but you really should know about callbacks and event handling from clientside JavaScript. The example code makes use of jQuery an you really need to know something about how this works as well. Even with the use of jQuery to reduce the amount of code you have to write there is a lot of wasted space and duplication. At end of the chapter you should have a grasp of events, non-blocking function calls, callbacks and the event loop. However if you already knew any of these ideas you are probably wondering what the fuss is about and still wondering what Node.js can do for you.

 

samsnodejs

 

This brings us to the end of Part I of the book. Yes the basic idea of Node.js were allocated only 50 pages. Part II takes us into building websites with Node.js. Chapter 5 explains what HTTP is and how to implement servers and client in Node.js. Just as we are getting into the details that are really core to Node.js the next chapter introduces the Express framework. After this most of the rest of the book is about one framework or another rather than core Node.js. This isn't too unreasonable in that this is the best way to build things with Node.js. Chapter 7 goes into more Express in more depth - mainly routing. Chapter 8 returns to core Node.js with a look at the file handling objects, reading environment variables and using MongoDB. 

Part III is about debugging, testing and deploying. The chapter on debugging introduces the stdio module so that you can do "print" debugging and the Node.js debugger. The testing chapter is mostly about third party test frameworks. The deployment chapter outlines the use of Amazon S3, Heroku, Cloud Foundry, Nodester and so on .

Part IV is about building more complicated sites. Chapter 12 explains what a socket is and how to use the socket.IO module. This is one of the facilities that Node.js provides that can be used to create applications that do more than a simple web page can do. It is the sort of area where it really could lead to innovations and this chapter does it reasonable justice in explaining the different ways it can be used to provide broadcast and bidirectional communications. Chapter 13 provides an example of a Socket based chat server, chapter 14 shows how to build a Twitter client that retransmits he data to other clients. These examples do give you a good idea of what you can achieve. Chapter 15 explains the Json APIs to exchange data.

Part V of the book is the most in depth and technical - Exploring the Node.js API. It covers the process module, the child process module, events module, buffer module and stream module. The first two chapters on the creation and managing of processes is reasonably well explained but not really motivated. You are left with little idea of why you might want to get involved with any of this. The bare mechanics are explained but not how this takes Node.js from a single threaded system to a multi-threaded, scalable, system. The chapter on the event module is similarly limited to brief look at the basics.  Similarly for the streams and buffers chapters - nothing more than basic introductions. If you were hoping for some slightly advanced material on Node.js this is where the book gets closest to that target but it still doesn't really do enough.

The final part of the book is about CoffeeScript, crating Node.js modules and using Connect and Backbone.js. All useful stuff but more on core Node.js would have been useful.

At the end of the day this book is over long and mostly at too simple a level. If you are a complete beginner and really need to have callbacks and events explained then you probably aren't going to get very far with server side JavaScript. The way in which the book deals extensively with other frameworks is also an indication that it is tackling the topic at too low a level. If you are a reasonable client side JavaScript programmer do you really need to have frameworks like Express and so on explained in detail? Do you really need a chapter on using CoffeeScript in a book about Node.js? The answer is you probably do if you want to make the book stretch over 24 hours of reading.  

If you are a complete beginner then you might have more sympathy for this book in its efforts to teach you so many different things, but even in this case you would be better rewarded by reading something on advanced JavaScript or jQuery. For the programmers who are likely to get much from learning about Node.js this book doesn't go deep enough. The best chapters are the ones on using sockets and it is possible you might want the book just for these.  

 

Banner


Core Java for the Impatient, 3rd Ed

Authors:  Cay S. Horstmann 
Publisher: Addison Wesley
Pages: 576
ISBN: 9780138052102
Print: 0138052107
Kindle: B0B8RZZBDJ
Audience: Smart programmers wanting in-depth coverage
Rating: 4.8
Reviewer: Mike James

The key to this book is the word "impatient" in the title. What does this m [ ... ]



Bare Metal C

Author: Steve Oualline
Publisher: No Starch Press
Date: August 2022
Pages: 304
ISBN: 978-1718501621
Print: 1718501625
Kindle: B08YJB9BCF
Audience: C programmers
Rating: 3
Reviewer: Harry Fairhead
Bare metal C sounds exciting and very basic. Time to find out how the machine really works.


More Reviews

 

Last Updated ( Thursday, 18 April 2013 )