TDD for the first-ish time

Matt Krump
Matt Krump

Yesterday, I finished working through the first example in Kent Beck’s Test-Driven Development by Example. I had gone through the book before in October at the recommendation of Colin Jones, so I was already somewhat familiar with it. Working through it again in C# was a good way to start getting familiar with the language, but overall I’m interested to see how TDD feels as part of my normal work flow. Admittedly, I’m somewhat new to unit testing not just TDD. Much of the work that I’ve previously done has tended to be iterative, and acted as a means to understanding a particular dataset. There usually wasn’t a spec and oftentimes you didn’t really know where you were going ahead of time, so there didn’t seem like there was a great way to test such work. At the same time, I’m sure plenty of the things that I did probably should have had unit tests.

The code submission for 8th Light required unit tests and was one of the first things that I did where I tried to write unit tests that fully covered the project. There was a point in the project that I changed the Minimax method to start using Alpha Beta pruning, and it was definitely a great feeling to make that change run my existing tests and upon seeing them pass, know that I could move on with confidence even after making a pretty fundamental change to the game logic.

Anyway, looks like next week I’ll start working on TTT in C# and will be using a TDD approach, so I’m interested to see how this goes.