This post originated from an RSS feed registered with Agile Buzz
by Laurent Bossavit.
Original Post: Thinking in tests
Feed Title: Incipient(thoughts)
Feed URL: http://bossavit.com/thoughts/index.rdf
Feed Description: You're in a maze of twisty little decisions, all alike. You're in a maze of twisty little decisions, all different.
"How", they say, "can you suggest that 'test' is literally the first thing in your development cycle ? Surely you can't write a test before having at the very least done a minimum of analysis, preferably on paper, to pin down what the interfaces are, the method names and what they're supposed to do and their parameter types and return types..."
Doing your analysis "on paper" amounts to jotting down thoughts. These are probably in somewhat symbolic form - squares, arrows, and so on. But you could just as well do it in English, I suppose.
Imagine you were learning French(*), and for the fun of it decided to write down your analysis thoughts in French. At first the process would be quite laborious - you'd have to formulate your thoughts in English to get them into a coherent state, then translate to French. After a while, though, as you grew proficient in French, you would directly put down your thoughts in French. (I know I'm painting a rosy picture - past a certain age one's brain is no longer plastic enough to learn to think in a new language, so it might take forever to get to that level of proficiency - but that's an implementation detail; just hold the rosy thought till I get to the next step.)
Now, in the above, imagine replacing "French" with "tests". A programmer who has been addicted to test-first for long enough is doing analysis in the language of tests. Her thoughts run "I want to assert this, which should follow from that, if I have this and that object set up with that data", but their function is the same as your quick jottings on paper... except that they will morph into an executable test seamlessly.
(*) If, like me, you are a non-native English speaker, substitute your native language for "English" and a language you don't know for "French".