TDD changes everything. I’m reasonably comfortable you’ve already heard me write this, or imply it. So it’s perfectly natural to wonder — well, you know — How does TDD manage to change everything?
The answer is really the answers, because TDD, like most valuable techniques doesn’t actually work in just one single way. TDD is multifarious.
Here, then, is the first way: TDD reduces the mental scope of the developer.
Juggling Ideas For Fun And Profit
It’s been fifty-plus years since the famous paper by George Miller entitled The Magical Number Seven, Plus or Minus Two: Some Limits on our Capacity for Processing Information.
He identifies a first approximation of the bandwidth of human intellect. He says it’s about two and a half bits, i.e. somewhere between 5 and 9. By this number he means to refer to the number of independent concepts or symbols that a person can hold simultaneously. In fifty years, researchers have amplified and altered Miller’s actual number, but the long and the short of it is that we still think he was either outright correct or at least correct-ish. Five-to-nine works pretty well, actually.
I like to think of this five-to-nine with a juggling metaphor: some people can keep five ideas in the air at one time, and others can keep nine ideas in the air at one time, and most of us in between.
TDD Focuses The Mind
When I say that TDD reduces mental scope, I mean that it allows the developer to focus tightly on a single problem.
The experienced TDD-ist works one small problem at a time.
Working on just one problem works, because it obviates the need for thinking of the two other kinds of problem.
- Problems you (or a teammate) already solved.
- Problems you anticipate in the future.
Free’d by TDD to focus tightly, the developer is able to keep a problem to something involving less than our natural mental limits.