Test-first programming
My friend and colleague Malte and I work on the same project although we’re located 500 km from each other, but yesterday he came to Stockholm for two days so we could do a little pair programming on some new stuff.
Having read the latest drafts of the fortcoming book on test-first programming, by Kent Beck, we tried using a “test list”, which felt really good. Also, I had been thinking about how to cure myself from the “mock disease”—that is, after having read about mock objects you want to solve all test problems using them—and we actually managed to write the tests without using mocks at all. That also felt good.
The things we’re doing now felt really complicated, but after some refactoring our classes are really lean and I feel that the rest of the stuff fits into the design we ended up with. This was a school-book example of where you should ignore any preconceptions regarding possible solutions and just drive yourself with tests in really small steps. Had we tried to design the solution fully in advance, the result couldn’t have ended up this simple—especially if we didn’t design longer than a day and a half, which is how much time we spent programming.