Sunday, November 6, 2011

Book Review: Test Driven Javascript


There aren't that many really good Javascript books out there.  Most of them cater to the "I want to validate a form" crowd of the last decade.  This is one of the few that really take us through the right way to develop client-side code.  I place this book among the top 3 books on Javascript I've read, and I've read quite a few.

Some novel sections to pay special attention to:
  1. Page 327 has a description of mocks and small integration tests.  It's important because there are some special circumstances you need to be aware of when you are testing code that is so heavily dependent on such an ugly DOM.
  2. The dependency management scheme described in the later 1/2 of the book is quite simple, but it works.
  3. The end of the chapter on Node.js describes a pattern called "promises" that is a nice OO callback mechanism.
Unless you are new to Javascript and you want to get to know the DOM API a little better, skip the entire section on Browser detection.  There is no reason why we should be writing Javascript browser detection when we can use extremely powerful utilities such as YepNope or just code to cross-browser APIs such as jQuery.

If you plan on writing any Javascript code and you follow modern program practices (TDD, Proper Modularization, etc) then you have got to read this book.

No comments:

Post a Comment

AddThis

Bookmark and Share