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.
Hello Sarah,
Met you @the last Ruby Hackfest in the city. I agree that learning through tests is very valuable. One complaint I have about the AWD book is that they developed the whole Depot application and then threw in the chapter after about testing (and as I understand it was written by someone other than the core authors as an after thought).
Learning a language by using TDD is a great way to go. Kent Beck’s TDD by Example has a section where he plays with Python by creating a test framework which is similar to what you described in this article. Pretty good read I think.
All this being said, I’m still trying to come to grips with TDD myself and wish there were more resources for Ruby that went from the “ground up” using TDD. Maybe you’ll write this book Sarah ;)