Monday, June 30, 2014

Book Review: [Manning] Single Page Web Applications by Michael Mikowski.


I recently had the opportunity to review Manning’s Single Page Web Applications by Michael Mikowski.

I’m impressed by this book.  The book is rigorous and extremely well structured - magnificently orchestrated.  Organized into 3 parts, “Introducing SPAs”, “The SPA client”, “The SPA server”, the author goes to great lengths to provide a very broad coverage of the subject.  Starting with the raison d’etre for SPA’s, then coming back to JavaScript basics to more advanced principles such as anonymous functions and closures before moving on to client-side SPA, then server-side SPA including use of MongoDB.  But the author is also very rigorous taking the time to explain the use of JavaScript prototypes representing a more JavaScript approach to object-oriented programming, as well as code verification using JSLint and testing using nodeunit.

Each Chapter in the book steps you through the creation of a chat application in a very methodical way as new functionality and techniques are added in isolation.  For example, during the ‘SPA client’ part, TaffyDB is proposed as a client-side datastore, which is then replaced by MongoDB in the ‘SPA server’ part.  It’s very useful to introduce TaffyDB, not just to show the possibility but also to allow it’s use for unit testing.

The book lies somewhere between a reference work and a cookbook because despite it’s very methodical tutorial-like approach it lacks some necessary steps to make it a cookbook. These omissions are minor, for example it’s implicit that JSLint can be used to verify JavaScript embedded in html files nevertheless it isn’t described how to do this (or maybe there was a problem with my JSLint installation - attempts as using JSLint on html would complain about ‘<’ Unexpected on line1, i.e. on the first HTML tag seen).
If you want to see what the final application looks like you’ll either have to work through the book cover to cover, or download the source code from Mannings’ site and jump in at chapter 9 - you’d have to know how to launch your application though (not hard, but you’d have to know ‘nodejs ch09/app.js’).

It would be nice to have the code available in working form, as a template in a PaaS (OpenShift for example, or Nitrous.io, Heroku …) and/or as a Docker (trusted build) image.  Having the sources available as git repo would be a good idea.
But I’m being very demanding here … we’re so spoilt in the 201x’s …
I created a Dockerfile available here and intend to make a trusted build available as that’s how I like to work.

The book concludes with Appendices with more than 30 pages on JavaScript coding standards and JSLint, followed by 30 pages on testing with Node.js/jQuery/nodeunit.

I’m no JavaScript expert but I’ve done some JavaScript, REST, MVC, MongoDB.  I found this book very easy to follow as the application is built up.

An impressive work crammed with good teaching and best practices!

No comments:

[Conference - CodeEurope.pl] Developing Micro-services on Kubernetes

In April I had the chance to present at CodeEurope.pl , first in Warsaw on Apr 24th, and then in Wroclaw ("wroslof" was my best at...