In my recent explorations of how to teach test-driven development (TDD), I have found a number of people writing about using testing for learning. First I read how Ross Niemi explored the assert method by testing it. He talked about feeling that he would like to prove that he understood the syntax. Then I read how Mike Clark developed his own test suite to teach himself Ruby. He talks about how he “used the language as a tool to explore itself. In the same way that a test is better than a specification, the language is better than a description of the language. The test is definitive.”
Also, as a response to my last post about test-driven teaching, Seth Walker told me about Ruby Koans, which are a delightful test-driven meditation on Ruby syntax. I find them really fun and have been assigning them as homework in my class.
In my work, I often learn about my design or the implications of my implementation through testing. It is one of the things that is so invigorating about TDD. Discovering testing as a self-paced learning tool was simultaneously surprising and obvious.