When you hear someone talking about Test Driven Development, what is the first thing that comes to mind? Is it “Gee, this sounds like a testing technique!”? If it is, you aren’t alone. Given that the first word of the phrase is Test, I guess you could be excused. But the startling fact is that Test Driven Development, or TDD for short, is not fundamentally about testing.
If Not Testing, Then What?
TDD is fundamentally a design technique. It’s really about thinking about the shape and feel of the class you’re writing right now, and trying to get the interface so that it feels right, based on what you know right now. There is no other time at which getting the interface right will cost less than it will right now, before there is any code holding you back, so you may as well spend a few minutes and think about the class you’re writing from the point of view of the users of your class. Later on, they’ll appreciate the time you’re taking now to make their lives better.
If you’d like an example of this, let me know. I’ll be happy to do it, and I’ll also know that someone is reading these rants 🙂