[ Content | View menu ]

“Hammers considered harmful”

Written on 18 Aug 2008

Here’s another post on the lines of: “Hammers considered harmful. Every time I use one, it strips the threads from my screws.” One of the clues is in the list of symptoms at the end of the first paragraph: “mammoth test set-ups”. The tests were complaining but not being heard.

In truth, we’ve done a dreadful job of explaining where interaction-based techniques are relevant and where they aren’t. I keep bumping into codebases that are supposed to be written that way but where the unit tests have baroque, inflexible setups because the team weren’t listening to the tests. I even saw Lasse Koskela, who knows what he’s doing, during a programming demo at the recent Agile Conference, slip into writing expectations for a simple clock object that should have just returned a series of values; J.B. Rainsberger, being more forthright than me, called him on it.

Romilly, one of my partners in crime collaborators, once said he was surprised when he started working with Nat and me, how simple our unit tests are and how few expectations we set. That degree of focus is one of the points we try to get across whenever we talk about our approach. I find that the best use of interaction-based testing is to nudge me into thinking about objects and their relationships, not as a single solution for all my TDD needs.

In the meantime, we’re working on making our ideas more accessible.

4 Comments

Write comment - TrackBack - RSS Comments

  1. Comment by Isaiah:

    Hey Steve, good to see you guys are putting out the book soon.
    People often say when using mocks “The tests are concerned with implementation rather than results.”
    I come to realize one of the key things to use mock objects effectively is to know what should be the internals of an object and the peers of an object (some times this is obvious but often its not). I found that my tests get very brittle when i get these mixed up.

    18 Aug 2008 @ 21:27
  2. Comment by Colin Jack:

    Really looking forward to the book. Looking forward to reading the details about the way you use mocking to drive the design but also looking forward to the sections on acceptance/integration testing.

    20 Aug 2008 @ 19:33
  3. Pingback from Recent Faves Tagged With "programming" : MyNetFaves:

    […] public links >> programming “Hammers considered harmful” First saved by drostanorg | 0 days ago Wordpress post via email First saved by Crimity | 7 […]

    28 Aug 2008 @ 09:00
  4. Comment by Ashley Moran:

    Haha, this article is priceless just for the line “Hammers considered harmful. Every time I use one, it strips the threads from my screws.”

    I have to get that printed and framed…

    25 Oct 2008 @ 18:36
Write comment