Node.js Blueprints – A good how-to book that covers plenty of JS frameworks and tools – #programming #bookreview

7338OS_Node.js Blueprints (1)

 

Node.js Blueprints

Develop stunning web and desktop applications with the definitive Node.js

Krasimir Tsonev

(Packt Publishing paperback, Kindle)

 

Krasimir Tsonev’s new Node.js Blueprints book has proven helpful for me as I try to become more adept at using Node.js and a few of the many software packages that can work with it, such as AngularJS, Backbone.js, Ember.js, ExpressJS, Grunt.js and Gulp.js.

If you’ve never used Node.js before, here is its official description from the Nodejs.org site operated by Joyent, Inc.:

“Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”

The focus of Node.js Blueprints is on showing readers the basics of how to use various frameworks, libraries and tools that can help them develop real-world applications that run with Node.js.

Tsonev’s approach is to introduce several popular frameworks, libraries and tools, provide code examples and explain the roles of various sections or modules within the code. The goal in each chapter is to help the reader learn how to work with a framework or other package and create a simple application — a blueprint for something bigger — that can run with Node.js

The book is aimed at intermediate-level JavaScript developers, especially “web developer[s] with experience in writing client-side JavaScript,” who are interested in using Node.js in web and desktop applications.

The 12-chapter, 268-page book is structured as follows:

  • Chapter 1, Common Programming Paradigms, focuses on how “common design patterns known in JavaScript” can be applied in Node.js, as well.
  • Chapter 2, Developing a Basic Site with Node.js and Express, shows how to use ExpressJS, “one of the top frameworks on the market,” in applications “using the built-in Express modules and…your own modules.”
  • Chapter 3, Writing a Blog Application with Node.js and AngularJS, explains how to use the Angular frontend framework with Node.js, MongoDB and MySQL to create “a dynamic application that works with real databases.”
  • Chapter 4, Developing a Chat with Socket.IO, points out that “every big web app uses real-time data” and how it is “important to show instant results to the users.” And it covers “the creation of a simple real-time chat,” while emphasizing that “[t]he same concept can be used to create an automatically updatable HTML component.”
  • Chapter 5, Creating a To-do Application with Backbone.js, notes that “Backbone.js was one of the first frameworks that introduced data binding at the frontend of applications.” A simple (but useful) to-do application is used to illustrate how to use the powerful framework along with Node.js.
  • Chapter 6, Using Node.js as a Command-line Tool, explains that many command-line tools have been written with Node.js, and this chapter shows how to create one. The result is “a simple application which grabs all the images in a directory and uploads them to Flickr.”
  • Chapter 7, Showing a Social Feed with Ember.js, is centered on producing “an Ember.js example that will read a Twitter feed and display the latest posts. That’s actually a common task of every developer,” Tsonev says, “because a lot of applications need to visualize social activity.” (Reviewer’s caution: Ember.js has a long learning curve, and this chapter just barely gets you started.)
  • Chapter 8,  Developing Web App Workflow with Grunt and Gulp, explains how to use two popular task runners. “Grunt is the de facto standard” for simplifying and managing tasks such as concatenation, minification, templating and other operations before an application is delivered to users. Gulp, meanwhile, is a popular build system. The projects in this chapter include generating a cache manifest file using Grunt, and concatenating and minifying using Gulp.
  • Chapter 9, Automating Your Testing with Node.js, is especially aimed at fans (and forced-by-employer “enthusiasts”) of test-driven development and behavior-driven development. The chapter introduces how to use the Node.js versiosn of the Jasmine and Mocha frameworks for testing JavaScript code and how to use the headless browser PhantomJS to test user interfaces. You also are shown how to use DalekJS, a Node.js module that allows you to control major browsers such as Google Chrome, Internet Explorer and Firefox while doing interface tests.
  • Chapter 10, Writing Flexible and Modular CSS, emphasizes how “[t]he Web is built on the basis of three languages–HTML, CSS, and JavaScript” and “Node.js provides really helpful instruments to write CSS…and improve our style sheets.” Other topics include the Less preprocessor, the Stylus preprocessor, the Sass preprocessor, and the AbsurdJS preprocessor.
  • Chapter 11, Writing a REST API, focuses on building a Representational State Transfer (REST) Application Programming Interface (API). The chapter’s Node.js project is “an API of a simple online books library. The resources are the books, and they will be accessed through the REST API.” Tsonev notes that “Node.js is very often used to build REST APIs. Also, because it is a common tool, we have several possible approaches.” In this chapter, however, the emphasis is “to build our REST API from scratch, because it will be more interesting and challenging.”
  • Chapter 12, Developing Desktop Apps with Node.js, declares that “Node.js can be used to produce desktop programs, and w don’t have to learn a new language or use a new tool.” In this chapter, Tsonev shows how to use node-webkit to create a file browser that runs as a desktop program, reads files from the hard drive, displays the files on-screen, and also displays images.

Tsonev’s well-written book introduces a lot of good material to help you get started. After that, you have to do the work to get better at using the various frameworks and tools. But the writer gives you plenty of possibilities to start with in your quest to become a better developer.

You may encounter an occasional typo in the book’s printed code. Thus, be sure to download the available code examples for reference, even if you prefer to type in code by hand (one of my favorite ways to learn, too).

And, during the lengthy process to write, edit, and publish the book, some of the software has changed to newer versions than are called for in the text–which may affect how something works in certain small areas of code.  Indeed, in programming books that rely on several different software packages, changes always happen, and those changes seldom are convenient to the printing deadline.

So if something doesn’t work the way you expect, and you are positive your hand-typed code has no known mistakes, don’t yell at the author. Download the code examples. Look for the publisher’s errata files. Seek out comments at book sites such as the readers’ reviews on Amazon, as well as comments on social media sites and specialized sites where JavaScript and Node.js developers hang out. Also take a look at the “official” websites for the frameworks and tools.

I have been wanting to learn more about working with Node.js, and Node.js Blueprints definitely is filling that need.

Si Dunn

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s