Menú Principal

Wednesday, May 16, 2012

Node: Up and Running – Review




Node: Up and Running

Node: Up and Running is a book for JavaScript programmers who want to get started with the foundations of Node.js as a nonblocking runtime environment and web server, covering essential features, popular third-party APIs and programming suggestions for building web applications and services, this time using JavaScript as the programming language on the server side. Node: Up and Running is for the reader the starting point to understand the main components like servers, events, callbacks and modules from which a Node.js application is made of.

This is a short, concise book that explains how Node.js gives solution to support thousands of asynchronous requests through its event-loop mechanism and core functionality. In chapters 1 to 5, we can find the structure of a basic, raw HTTP Node.js server, what request callbacks mean, and how to organize these callbacks to obtain clarity and consistence. We can also find basic utility functionality dealing with IP addresses, clusters and child processes, and how to encrypt public and private application keys.

In chapters 6 and 7, this book explains briefly the most popular third party Node.js modules from which we can actually use for building useful web applications and services. We can briefly learn how to setup database connections, operations and queries, ho to build a basic, managed HTTP server with the Expressjs module for web page rendering; and how to work with WebSockets, the new feature found in recent version of web browsers for persistent connection with the server. Final chapter 8 explains to how to publish our own Node.js modules to share with the community.

What I liked most of Node: Up and Running is that it offers suggestions to avoid pitfalls when dealing with callback chaining, why a ‘try…catch’ block doesn’t catch an asynchronous exception and how to distribute the work load on several CPUs when possible (chapter 3). Programming good callback chaining and monitoring mechanisms is important to improve readability and maintainability, and to avoid possible hang-out conditions due that certain I/O events may take long time to be processed, like downloading a file and querying a database.

I think the benefit after reading Node: Up and Running is that the reader gets an initial understanding of how a Node.js HTTP server works and how to combine core with third-party functionality. That is, this book gives the reader an overview of how the Node.js world is structured and its possibilities becoming JavaScript available on both server and client sides. Yahoo! said this fact is a potential transformation in software architecture.

However, if the reader really wants to build a web server he/she should look for more information about Node.js frameworks like Expressjs, Restify and Mojito since this book only introduces the basics. But, Node: Up and Running opens the doors to understand how a Node.js HTTP server works so the readier will be able to understand the vocabulary, the mechanics and the good practices offered by each module and framework.

A negative point to this book is the absence of how to structure the different layers of a Node.js application like the business, data access and security layers. The book doesn’t show how to break functionality into several JavaScript files. I think a final chapter 'Putting it all together' would have been useful.

Finally, I want to say that there’s a difficulty to imitate some code examples because the directory structure was not specified. You’ll notice this when reading the Twitter App on chapter 2. That may change if O’Reilly Media publish the accompanying source code or a book update. Meanwhile, you can read the errata section at the publishers web site.

Note: This review is in exchange for the O'Reilly Bloggers Review Program (http://oreilly.com/bloggers).

I review for the O'Reilly Blogger Review Program

7 comments: