Review of Kent Beck’s TDD book
Test Driven Development: By Example by Kent Beck
My rating: 5 of 5 stars
This book has a simple purpose: show in clear and understandable language how to approach TDD. Nothing more or less, and he succeeds very well.
Other reviewers have commented that they were annoyed about how this book didn’t cover mocks and stubs and a lot of the other artefacts of testing – that wasn’t Beck’s purpose, he wanted to show how it’s done and then catalogue the patterns needed in order to make it work. While he covered mock and null objects he didn’t go into the details because these are very much part of the testing framework you are using and the limitations of the language you are working with. They will be covered (to death) in the documentation associated with it – the ideas, the principles, they work everywhere.
I will use this book the next time I teach TDD, and I will use the patterns section the next time I get stuck. I also liked the section where he uses the ideas in TDD to develop an xUnit framework using Python – using the ideas to develop the framework is a very useful approach. He also says that this is how he learns new languages – implement the xUnit framework in them. Which also then gives you what you need if you’re going to get “serious” and write something longer.
The other thing that struck me was that, like Bob Martin in Agile Software Development Principles Patterns and Practices, he talks about finding design patterns as you work. Martin talks about “backing into” a pattern, this book has an afterword my Martin Fowler that says similar things, the pattern comes out of the refactoring and you implement it in a way that makes sense for the problem in front of you. Avoid the endless, sterile project meetings about which variant of what pattern – write some tests, understand the problem and then “back into” an appropriate pattern, if you need to. But get it done and move on.