Test Driven Development: By Example

Kent Beck (2002)
Review date: September, 2008
Summary

This book is divided into three distinct parts. In the first part, the author demonstrates TDD by example by developing some classes for multi-currency computations. Little theory is to be found here. Just examples.

The next section contains more advanced TDD: an implementation of the xUnit in Python framework is evolved.

The last part contains some theory; primarily some patterns for TDD itself, descriptions of the most common design patterns, and a wrap up chapter that further sells and explains TDD.

Opinion

I try to start with the most important message first. Here it comes! This book will not teach you TDD. Forget it. I have read it on two different occasions. The first time this really was my first text on TDD, and after reading it, I got the hang of the central concepts (not well enough though), but was completely unprepared to transfer this new-gained knowledge to my work. The reason for this was that the book contains very simplistic examples. Yes, they serve well in explaining test-driven development, but they are very far from our practical reality, in which we deal with n-tier systems with web front-ends and application servers. Very little discussion is devoted to such things, and a concept as central as mocking, is only lightly touched.

While reading it the second time, I had practiced TDD for quite a while and had read a couple of books on both TDD and testing in general. All-in-all I had a pretty good grasp of the methodology. At that point, reading this book was quite rewarding. It explained some misconceptions I had developed and did clarify some things I was uncertain about, like for example the size of the implementation steps to take, why triangulation feels weird, and when to go with the naive implementation. At that point, the book was really good, and I could extract the author's deep experience.

Structurally, this book is simple to read, but I suggest that you take your time, and read and understand the examples, especially in the first section. I have trouble understanding the value of the second section. Just putting in some Python implementation of the xUnit framework feels alien. It's not a good example in a book that starts with Java code, and it feels awkward. Period.

Parts of the theory in the last section are really good, but in the middle of everything comes a chapter where some of the most common design patterns are listed. There is some argument about the reason for including them, but it eluded me.

In total, this book contains unexplainedly little theory. It starts with a bang, the first example, and sums everything up quickly in the end. In conjunction with being as small as roughly 200 pages, it really is a small classic, and a big surprise for the unsuspecting first-time reader.

Once again, this book will not give a newcomer the tools to start implementing TDD in his daily work, and can even serve as a source of confusion. On the other hand, TDD practitioners can find some real gems in there.

Who should read this book

This is one of the classics referenced and quoted everywhere, and those who want to see how it all started should read this book. You should have an academic or historical interest in TDD to fully appreciate this book, or be proficient enough to appreciate the deeper insights scattered around in the text.




News

  • 2015-09-29

    It's been almost one and a half year since I reviwed a book! I've been too absorbed by Writing my own. Anyway, I'm back with Jeff Patton's relatively...
  • 2014-01-04

    New category! Performance! Reviewed The Every Computer Performance Book. Check it out!
  • 2013-09-10

    Reviewed a book that' slightly less technical, but much more fun to read. It's I.T. Confidential.
  • 2013-08-13

    Reviewed yet another book on Visual Studio 2012 and TFS. I also created a "Microsoft" category and moved the other TFS book there from the "Tools"...
  • 2013-08-05

    Updated the FAQ. Included information about getting a book reviewed.