x/Unit patterns is a great book that fills a void I unconsciously would run into in projects using TDD. While several great books have been written about how to design and refactor our application code not much critical practical attention has been given to how to write test code. Most of it has been "do what I do" or heated discussions on why one strategy is better than another. I would often see "smells" end up in my test code, which I would attempt to refactor out. Yet, since I am still learning TDD I would often re-refactor my TDD code because I would often change my mind about why I made a change. I would also question whether or not I really was improving my project code by refactoring my TDD code.
xUnit Test Patterns definitely is a great addition to this space and fills a much needed gap. It helps put much needed background, concrete analysis and details around these areas. It will easily become a staple in the modern developer's reference collection.
This is not an intro to TDD book. If you do not use TDD and are wondering just what it is I would suggest you look elsewhere. If I had been given this book when I was entering the TDD space I would have been overwhelmed.
If you have used TDD on a project or two, with varying success, this would be a great book. It's a very easy read with a basic understanding of TDD. It opened my eyes on exactly why TAD (test after development) was much worse than simply "don't do it that way". It allows me to help explain TDD much better than saying, "just because you're supposed to". It also lays out a very detailed analysis on why you may or may not want to use fresh test fixtures versus shared as well as using persistent data. Both can be very hot controversial issues, yet Gerard explains the very fundamental reason behind the various strategies and where they may each be used with confidence. Of course, he explains why it may be very bad to use in certain situations, which are usually producing smells in our test code.
If you are an academic in this space (not just the casual user) and love the other Fowler books I would definitely recommend you add this to your collection. As I mentioned above, it establishes concrete naming conventions (based on original papers and commentaries) and provides a very detailed analysis of much of the current discussions in this space.
In the first half Gerard gives a very thorough tour through the TDD space including the benefits of using TDD, various strategies and their pros/cons, details of how most xUnit frameworks work and so on. Most of this is probably fairly familiar ground for those who are intermediate in TDD but it's a very quick read through. It filled in a few holes for me, but most importantly, like other refactoring/patterns books it helps put a concrete framework and names around the various methods. It helps facilitate great conversations where developers using TDD can speak on a common ground, an area that, at least in my circles, has been lacking.
The 2nd half details the actual patterns. Much in Fowler-academic pattern style, each pattern is listed with its name, what it attempts to accomplish, pros/cons and samples of use. He includes a vast amount of patterns, many of which I have ran into yet not been able to put my finger on why I decided to use it in one project and not another. He also makes a great case why the same pattern may be very useful in one context but an anti-pattern in another. Looking at the various pros/cons I really began to fill out my arsenal, if you will, with strategies I used to dismiss, however, in certain difficult contexts they would have actually fit the need perfectly.
If you have been using TDD in your projects, with whatever level of success, I would definitely recommend you add this book to your collection. As I said above, it's a quick yet detailed read and adds much needed tools to your TDD tool belt.
less
0 comments
Post a comment