Book Review: “The Grumpy Programmer’s Guide To Building Testable Applications”
Out Of Date Warning
Languages change. Perspectives are different. Ideas move on. This article was published on April 18, 2012 which is more than two years ago. It may be out of date. You should verify that technical information in this article is still current before relying upon it for your own purposes.
When most developers think about books on testing, they think about books that highlight things like “test driven development” or “how to build a test for X.” There are lots and lots of testing books out there that supposedly teach us how to write tests and reach milestones like “100% test coverage.” But at the risk of sounding risque, testing is very similar to sex: more people claim to do it than actually do, most people claim more experience with it than they actually have, and more people have advice on the subject than probably should.
This is not true of Chris Hartjes’ book, “The Grumpy Programmer’s Guide To Building Testable PHP Applications”. When I asked Chris if I could review his book, I expected a step-by-step guide to writing tests. What I got was a step-by-step guide to building an application that COULD be tested. There’s a big difference, and it’s important to understand the distinction.
Writing tests is certainly hard; Chris makes no bones about this. But testing is made unnecessarily difficult by bonehead developers who consistently write applications that are resistant or impossible to test. It is in this framework, then, that Chris focuses most of his energies: writing (or rewriting) an application to be testable. Rather than embracing a particular methodology, framework or behavior, Chris adopts the tactics and techniques that work to build applications that can be tested, and shows exactly how to test them along the way.
Chris’ book isn’t perfect by any stretch and it won’t solve every one of your test or application development problems. That’s not it’s purpose. It’s purpose is to provide examples and guidelines for building an application that won’t cause you to rip your hair out when you go to test it. Chris walks a fine line, but his experience with testing and application development gives him the credibility necessary to advise and instruct in this area.
There are many words of wisdom in the book, from “if it’s not yours, wrap it up” (on building wrapping layers) to “testing is good; testable applications are better.” His admonition that the development environment and the deployment environment should be as similar as possible helps eliminate those “it worked on my machine!” moments, and is something I’ve believed in for years.
The book is for sale at LeanPub for a suggested price of $15. In truth, it’s worth twice it’s price, and I highly recommend it to anyone who struggles with developing testable applications.
Write better object oriented PHP today.
Object oriented programming always leaves you with a headache. What if you could master it instead?Get the book now! »