In approaching any new language, there are many learning curves to overcome. What are the most frequently used API’s? What frameworks should I use? What patterns and idioms? Reading books and blogs can help, but there’s no substitute for getting your hands dirty and doing some coding. Thinking about software development instead of actually developing software is a lot like thinking about playing a guitar instead of just picking up your axe. You need to write code to learn, but you don’t want to limit your learning to what you do on the job, nor do you necessarily have the time or interest to start a toy app.
Enter unit testing. Unit testing gives you a way to build yourself a library of examples that are verifiable, executable, and self-documenting. This technique isn’t new. 4 years ago, Mike Clark wrote the best material I’ve found on the subject:
I only found these posts about 6 months ago, however, and I suspect many people haven’t seen this technique. I’ve found it to be a great way to practice in a safe environment rather than subjecting production code to my experiments. It’s the code equivalent of learning to play the daf in a sound studio: You can record yourself, use reference materials, and do as many takes as you want. And you won’t disturb the neighbors.
Andy Hunt of the Pragmatic Programmers has a blog post on test-driven learning in which he talks about mixing the technique with concepts like the spacing effect and spaced presentation. “Spaced repetition is a learning technique that exploits this psychological principle by incorporating increasing intervals of time between subsequent review of previously learned material.” I’m interested in exploring how this system could be used in mastering software API’s. In the meantime, I’ll keep working on test driving my way through a few more API’s and will blog any interesting surprises I find along the way.Tweet