· coding-dojo

Coding Dojo #21: TDD as if you meant it revisited

In this weeks dojo we decided to revisit the “TDD as if you meant it’ exercise originally invented by Keith Braithwaite for the Software Craftsmanship Conference but recently tried out at the Alt.NET UK Conference in London.

The idea was to write code for ‘tic tac toe’ or ‘naughts and crosses’ and we were following these requirements:

The code from Alt.NET UK is available on Google Code and what I found quite interesting is that the solutions are really quite different to each other.

Our code is up on bitbucket and again it is quite different to the other approaches.

For most of this week’s dojo Dave and I just worked together on the problem although a colleague did come and join us for the last half an hour or so. We were just pairing on a Mac.

The ‘Square’ object was one which neither I nor Dave had expected to exist. We had imagined that code would end up on the ‘Game’ object and interestingly just before our colleague joined us we had drifted from the rules of the exercise and actually written the outline of a method on the game object to satisfy the 5th acceptance criteria ‘a player can take a field if not already taken’.

Luckily we undid that and it became obvious that the new code should be on an object of its own so that’s what we did.

We discussed this at the time and it seemed that any alternative approach where we didn’t do this would end up with us writing a really big test (perhaps with players making moves), therefore meaning the feedback cycle would be really slow.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket