
Test-Driven Development (TDD) is one of the core practices of XP. Generally when I introduce people to the concept, I either get a look that says I’m crazy, or they comment on how they used to do that “back in the day”, which generally leads to discussions about walking uphill 20 miles in the snow to pick up some punch cards, etc, etc.
Lately I’ve been reviewing my wife’s materials from her I/O Psychology classes. One of the books that has really caught my interest is Understanding Motivation and Emotion by Johnmarshall Reeve. I’ve been reading a section on cognitive approaches to motivation, when I stumbled across the TOTE model.
Turns out that in 1960, a group of pyschologists (Miller, Galanter & Pribram) theorized that people have in their minds what is ideal in the current situation, and when they find a mismatch between the ideal state and the current one, they adopt a plan of action to correct it. They called it the Test-Operate-Test-Exit (TOTE) model, and it looks like this:
Which, oddly enough, looks very similar to the TDD model:
So, the interesting thing is that TDD feels so natural to so many people because it is how they would normally act in a given situation.
Further reading: