Paired Programming at 30,000 feet
It’s actually pretty fun. James and I were on our way back from TechEd yesterday and decided to start a small community project we’ve been talking about for awhile (and didn’t find any time through the week to work on). After a quick 20 minute discussion about some of the goals we wanted to accomplish, we cracked open the laptop on the plane and James wrote the first few tests.
He then handed me the laptop to implement the domain.
Ahh, TDD at it’s best. Just some tests someone wrote with ideas around how they want to implement the system and your task to do it. This went on, back and forth, for a couple of hours on the first plane and resulted in a few discussions, a bunch of tests, and some good fun.
We hopped onto the plane from Minneapolis to Calgary and started up again, this time I wrote the tests and he implemented the domain. Of course, as you get further into TDD the tests start to get harder because you get past the glamour of the first few tests (adding items to collections, checking properties) and dig into the real heart of the problem.
It’s a great excercise because about halfway through we tossed out a couple of classes we pre-supposed we would need. The great thing is, the tests still passed even after removing the classes. Using .NET 2.0 and Generics we got rid of an entire class and just used a combination of SortedLists and the Dictionary class, which made things simpler. I still think there’s simplification that can happen, but we had to bow to the great airline people and close the laptop for the day.
The end result? A few hours of coding, 4 or 5 domain objects, 100% coverage, and 22 tests. All green baby.
Programming can be fun, even at 30,000 feet in the air with no wireless.