RSS RSS feed | Atom Atom feed

Review - Test-Driven Development by Example

I recently reviewed Kent Beck's "Test-Driven Development by Example". It got pretty good reviews on Amazon, but I have to admit, it didn't really do too much for me. I rated it at six horseshoes, which is three stars on Amazon. I've read pretty much every book on TDD and unit testing, and this has been the worst of the lot in my opinion. It was okay, but definitely I could have gone my whole life without reading it and not been any poorer for it.

The meat of the book rests in two sample projects which are used to demonstrate the TDD process. The first one, which Beck refers to as "The Money Example", was my favourite of the two. It's a nice simple easy-to-follow introduction to TDD suitable for a complete novice to follow and gain some clue as to what this whole TDD thing is all about. I had always referred people to Bob Martin's bowling example in the past, but this one goes into a bit more detail and involves a bit more hand holding.

The second example was an implementation of xUnit. Only in this chapter do we finally begin to get some clue what the xUnit API really is, even though he used it without comment throughout the first example. For some reason Beck thought it would be a good idea to switch to Python for this example. I'm sure Python is a fine language and all, but let's not make the readers work any harder by making them come up to speed on a language that likely the vast majority aren't using. It's not that it was so difficult to figure out, it's simply that it was an unecessary barrier placed in front of the reader.

There were other things I didn't care for about this book, but I pretty much addressed those things in my review, so there's no need to repeat it. I found the David Astels title test-driven development: A Practical Guide to be a much more useful introduction to TDD in just about every way (see my review here and here). If you primarily work in Java, you should gain much more from the Astels book than you will from this Beck title.



Re: Test-Driven Development by Example

Nothing wrong with using Python for the examples. It's been described as "executable pseudocode" and reads easily. As Kent Beck doesn't aim the book at Java programmers, you could as well say that using Java for one example was wrong because there's a lot of people not using Java. A prime reason to use different languages would be to show that the principles he explains aren't limited to just Java (or whatever).

Re: Test-Driven Development by Example

You are correct in that Python is relatively simple to read, but my point wasn't that Java wasn't being used, but rather a common language that most readers could be expected to know wasn't being used. C++ would have been fine for example. The fact that he decided to use Python, likely for the reasons you suggested, was just basically annoying more than anything else. I was already having issues with the book up to that point and that was just yet one more point of contention for me. Keep in mind though that it wasn't my only problem with the book, just one of several issues. After having read the book, I do maintain that he could have achieved the same thing with that second example if he used a widely known language such as C++ or Java, without making his readers work harder than necessary. How many readers do you think would take the time to try out the code in Python versus the number who would try out the code if it were in C++ or Java?

Re: Test-Driven Development by Example

The thing about Python is that it has a good deal less extranious crap than either Java or C++. This makes it a great language for book examples. Not to mention a great language for just about everything! ;-)

Add a comment Send a TrackBack