Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Beginning Node.js
Syed B., Apress, New York, NY, 2014. 308 pp. Type: Book (978-1-484201-88-6)
Date Reviewed: Oct 29 2015

Software developers or computer-savvy people who need an excellent introduction to this relatively recent alternative to well-established web servers and web server coding are the audience for this book. It is well written and logical, with gradually increasing complexity and many downloadable and easy examples. All chapters have a short introduction and end with a summary and sometimes additional resources.

Chapter 1, “Setting Up for Node.js Development,” describes Node.js installation on Apple Mac or Microsoft platforms. Computer screen shots accelerate learning and are used throughout the book. Here, any reader armed with a computer and downloaded examples can trigger the first “Hello World” app.

Next, “Understanding Node.js” introduces the basic elements of JavaScript and follows with descriptions of objects, error handling, and basic object-oriented programming (OOP). Readers will understand the concept of a web server in different implementations and how Node.js is different: an event loop in one JavaScript thread. Possible drawbacks such as thread starvation are mentioned here, too.

The focus of chapter 3, “Core Node.js,” is importing and exporting data/objects and sharing in-memory objects. Readers will learn about conditional loading of modules and how execution is blocked until the code is loaded (very important in an asynchronous environment). Some core modules and “globals” are introduced: path, fs, os, util, console, setTimeout, setInterval, clearInterval, and so on, with excellent notes about differences between synchronous and asynchronous execution.

In chapter 4, “Node.js Packages,” the main topics gravitate around the Node.js package manager (npm). It emphasizes module side effects and incompatibility. It introduces the JavaScript object notation (JSON) format, its utility functions, and semantic version numbering. It exemplifies functional programming through popular packages such as underscore (for basic data processing), optimist (for handling command line arguments), moment (for date formatting), colors, and others.

In my opinion, “Events and Streams” (chapter 5) is essential for understanding OOP implementation in JavaScript. Inheritance can be defined by “__proto__” chains and “.call” or simplified via “inherit” from the “util” package. Other topics touched on here include events, subscribing and unsubscribing listeners, sharing between subscribers, possible memory leaks, errors, signals and exception handling, and the pipes and streams.

Key to building web-based applications is chapter 6: “Getting Started with HTTP.” The author reveals the anatomy of the hypertext transfer protocol (HTTP) request and response, the raw communication streams between server and client, and shows how packages like “connect” can simplify coding. He gradually introduces authorization, authentication, and the need for encryption, with many hints on good coding practices.

“Introducing Express,” chapter 7, describes a package providing a standard optimized and well-tested web application framework with many out-of-the-box functionalities: serve static pages, serveindex, JSON requests parsing, embedded URLencode, and so on. The author exemplifies representational state transfer (REST) methods for data collection management and webpage routing.

Chapter 8, “Persisting Data,” focuses on nonrelational databases that help with the management of collections of documents, data trees, or graphs. Unfortunately, the example source code is damaged and could not be used. Understandably, specialized solutions like MongoDB can simplify development.

The next chapter, “Front-End Basics,” clearly explains the concept of a single-page application and how XMLHttpRequest is used to render changes in the already present webpage. The examples use the angular framework, the popular bootstrap.css, and jQuery library. The code is more complex and many coding conventions are mentioned.

With so many chained callback functions in the Node.js asynchronous environment, chapter 10, “Simplifying Callbacks,” becomes very important. The order of execution can be controlled by the use of process.nextTick and the modern and popular “promises” (asynchronous code constructs placed in a queue after the execution of the synchronous code). Other concepts described here are generators with or without promises.

Chapter 11, “Debugging,” presents functions such as console.log, console.time, console.timeEnd, console.trace, and console.error, and debugging options (setting breakpoints, watch variables, step-by-step execution) or additional tools and utilities such as node-inspector and Webstorm.

As a logical continuation, in “Testing” (chapter 12) we see popular constructs such as assert, which is important for verifying code conformity to requirements. Testing frameworks such as mocha, chai, or node-inspector can further ease testing and allow stopping and resuming execution at will for detailed debugging.

The book ends with “Deployment and Scalability,” which exemplifies automatic node restarting and communication between child workers using fork and process. It finishes with a description of Amazon Web Services and shows a quick installation and deployment of a small Node.js-based web application. The examples for chapter 13 are missing in the zipped downloadable code.

It’s up to the reader to decide whether using JavaScript on the browser as well as the web server (Node.js) is a good thing, as the author argues at the start.

More reviews about this item: Amazon, Goodreads

Reviewer:  Adrian Pasculescu Review #: CR143896 (1601-0006)
Bookmark and Share
  Reviewer Selected
 
 
Object-Oriented Programming (D.1.5 )
 
 
Javascript (D.3.2 ... )
 
 
Reference (A.2 )
 
Would you recommend this review?
yes
no
Other reviews under "Object-Oriented Programming": Date
Object-oriented programming systems, languages, and applications
Paepcke A.  Object-oriented programming systems, languages, and applications,Phoenix, AZ,Oct 6-Oct 11, 1991,1991. Type: Whole Proceedings
Oct 1 1992
Object lifecycles
Shlaer S., Mellor S., Yourdon Press, Upper Saddle River, NJ, 1992. Type: Book (9780136299400)
Apr 1 1993
Object-oriented programming
Voss G., Osborne/McGraw-Hill, Berkeley, CA, 1991. Type: Book (9780078816826)
Oct 1 1992
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy