I am delighted to share my review comments of the book, ‘Node.js Blueprints’. Author of the book is Krasimir Tsonev who is a coder with over 10 years of experience in web development. I thank Packtpub publishing for the invitation to do the book review.
Chapter 1, Common Programming Paradigms: Introduces us to the most common programming paradigms. Its starts with Node.js fundamentals like non-blocking I/O, evented loop. Further, it introduces readers to module definition and how modules created using module.exprots can communicate between themselves.
With the help of examples, we are introduced to asynchronous programming using callbacks and promises. There is a brief description of what promise is though it does not talk about Promises/A and Promises/A+ specifications.
To define and explain middleware architecture, we come to know about Connect. Connect is a framework that uses modular components called middleware for creating web application logic in a reusable manner. Simply put, middlewares are functions that handle request, responses and also can signal errors. As a reader I can expect more details about Connect as it is one of the important parts of Node.js arena.
Chapter 1, ends with the introduction of managing dependencies using Node Package Manager(npm) and Package.json.
Chapter 2, Developing a Basic Site with Node.js and Express: This chapter take us to the land of web application frameworks. The Express web framework is built on the top of Connect and it provides tools and structure that make writing web applications easier and faster. We learn the following items about Express:
1. Installing Express
- Using package.json
- Using a command-line tool
- Managing routes
2. Handling dynamic URLs and the HTMLforms
3. Returning a response
Express examples are developed using Express 3.x and Jade as a template engine. The step-by-step simple examples guide us to develop application using Express. I feel the use of express-generator is very handy.
Chapter 2 could have thrown light on Express 4.x features and how a user can upgrade an application developed using Express 3.x to Express 4.x. Further, use of another template engine like EJS could have been an added bonus.
Chapter 3, Writing a Blog Application with Node.js and AngularJS: It has guided user well to develop a blog application using Angular, Node, Jade, MySQL and MongoDB. Author has beautifully explained the concepts of Angular. So if you are not familiar with it, you will learn it easily. MongoDB and MySQL version of the queries are easy to understand. Understanding these examples will definitely help you get started.
I could not understand the following paragraph in summary section:
I believe, author could have given a better explanation of developing an AngularJS application with Node.js and why AngularJS is very good framework.
Chapter 4, Developing a Chat with Socket.IO: This chapter introduces us to real-time web applications with WebSockets and Socket.io. But I am not happy with the difference or similarities written about WebSockets and Socket.io. A better read can be found in the following link:
Also instead of using “*” in module installation in package.json, following links give you other ideas too:
Real-time chat example will give you an idea of socket.io usage.
Chapter 5, Creating a To-do Application with Backbone.js: Here, we will learn to develop Backbone.js application with Node.js. Similar to developing application with AngularJS in one of the previous chapters, author has explained Backbone.js at first. This is always good for anyone not familiar with the library / framework.
Chapter 6, Using Node.js as a Command-line Tool: We have got a good example using Flickr APIs. But I feel reader would have been benefited more if the following topics were covered with simple examples too:
- Parsing command-line arguments
- Working with stdin and stdout streams
Chapter 7, Showing a Social Feed with Ember.js: Author talks about developing Ember.js application with Node.js. As usual, you get introduced to Ember and how it takes care of the front while Node will handle communication with Twitter API to get the latest twits based on a user handle.
Chapter 8, Developing Web App Workflow with Grunt and Gulp: This chapter will bring a break if you have got bored with too many JavaSctipts. As the title says, it will teach two JS task runners, Grunt and Gulp respectively. This is a bonus I believe, as very few books of Node.js will talk about them in such length. But the missing part is the difference between these two task runners.
Chapter 9, Automate Your Testing with Node.js: Here author talks about unit testing Node.js application using Jasmine, Mocha frameworks. Wow!!!! Something interesting is coming our way. It talks about two testing methodologies – Test-driven development (TDD) and Behavior-driven development (BDD).
In addition to that, it also talks about several types of tests that you may write, which evaluate our system by giving an input and expecting a specific output.
It does not stop there; we now get ideas of testing with a headless browser like PhantomJS and with DalekJS you can do cross-browser testing. This chapter will take you to a different world which you will enjoy very much.
- Writing modular CSS
- BEM (block, module, modifier)
- Object Oriented CSS (OCSS)
- Scalable and modular architecture for CSS (SMACSS)
- Automic Design
- Less preprocessor
- Sass preprocessor
This is quite surprising that a Node.js book is touching so many important and vast topics of CSS where each of these topics can span several chapters.
Chapter 11, Writing a REST API: Now author talks about developing a REST API from ground up, which is really good. Also, in this chapter, you will have examples of Node.js MongoDB interaction using ‘MongoClient’ as an adapter. But the chapter has missed out the below topics which could have further pleased the readers:
- How to use mongoose
- Restify – It is a node.js module built specifically to enable you to build REST web services
- Express vs. Restify in REST context
Chapter 12, Developing Desktop Apps with Node.js: Finally we will shift from web application development to desktop application development using Node.js. In recent times people are talking about this in several JS meetups and conferences, so I think, ending the book with this topic will have lasting impression about the book in readers’ mind.
Overall, I have found the following positives in the book:
- Simple and easy to understand English
- Well defined concepts
- Node.js interactions with popular frameworks
- Good coverage of Unit Testing methodologies
- Well explained CSS topics in nutshell