Taken from a very high level, most of the book is unsurprising: the basic idea of test-driven development can be explained in roughly five sentences, and the rest of the book follows naturally. The book does show quite a few techniques and tips on using the test-driven methodology, and it's useful to read them all in one place, although most programmers would eventually discover most of them independently—but did I mention reading the book was fun?
The third part of the book, titled "Patterns for Test-Driven Development", deviates from the "telling a story" format, and the difference is quite noticeable. Although the section is still interesting and useful, it tends a bit closer to the "patterns are so important the text must be repetitive and boring" style (of which The Gang of Four book
I really missed a larger-scale example in the book; the examples provided very rarely contained a method longer than 10 lines, with roughly 3 lines being the average method size. Splitting a real-world program in so many small pieces of code seems to me rather impractical—it requires introducing too many helper objects to hold variables, and holding too many additional concepts (e.g. method names, object relationships) in one's head at a time to be able to think about the overall algorithm spanning perhaps 100 or 200 lines. A larger-scale example that demonstrated how real-world code written using the test-driven development methodology could look like would be quite useful to evaluate the methodology in other terms than achieving outstanding test code coverage.
In any case, the book is interesting and fun to read - even if you "never have time to write tests", don't hesitate to read it if you get the opportunity.
No comments:
Post a Comment