Review - Test Driven Development by Example
April 10, 2017
Another of my new year resolutions is to read three computer science related books. So, the first book I choose was Kent Beck’s book on TDD. I would say this book is the quintessential book on test driven development. I have owned this book for quite a few years but have never gotten around to reading it. So finally, I have taken plunge and have completed reading the book 😊.
This book is under two hundred pages long and my initial impression was that it was an introductory style book for TDD. After reading the book, I’ve realised it’s a lot more. The book is divided into three sections. The first section goes through the process of building new functionality into an existing software product using the TDD method. It takes you through all the steps and shows the pitfalls you might encounter. The main purpose of the scenario is to teach you the concepts with an example that will be easy to understand. It hammers home the importance of taking small test while writing new tests and writing enough code to make your tests pass. Following the write-run-refactor mantra is important and it also shows that taking bigger code steps might actually be counterproductive in the long run. I think as developers we are often too eager to sling code but the TDD process does force you to think before you leap. The second section goes through the process of setting you environment and testing framework. The third section I found very interesting, it’s more of a reference section. I can see myself referring to that section a lot more in the future. It covers patterns and practices for TDD and refactoring and design patterns in general.
After reading the book I appreciate the importance of taking smaller steps in code when doing TDD. I understand the reason behind writing enough code to make your test pass, since it prevents from over engineering your problem and falling into the YAGNI trap. Overall I think this book is good to help you get into the TDD mindset.