One of the questions I get asked quite often is how I learn new programming techniques. After all, I work with a broad range of languages and IDEs in my pursuit of new programming environments. Let’s face it—I like to play with code. For me, it’s not really a job to write application code. I like to see how different things work and what’s possible with a given language. In order to accomplish my goals, however, I need to learn techniques quickly. The debugger is my secret to learning how to code quickly and easily. In fact, I’ve written an article on the topic, “Improve Your Coding Skill by Listening to the Debugger.” You also see this technique emphasized in a number of my books, especially LINQ for Dummies and Start Here! Learn Microsoft Visual C# 2010 Programming.
The main reason that I use the debugger as an educational tool is that I can see the code in action. It’s possible to see how the code actually works, rather than envision what the code is supposed to do. The difference is important. For me, seeing the code actually work demonstrates that the theory behind the code is sound. Many theories sound good until you actually try to use them—using the debugger proves the theory as you work through the code.
From a personal perspective, the biggest hindrance that I face in using the debugger as an educational tool is the lack of good comments. In fact, comments are such a problem that I write about them in Creating Useful Comments. When the code lacks comments, I need to look up the calls myself and then determine how the developer is using them. It’s time consuming and a somewhat painful way to learn at times because I can see the code work, but I don’t know how it works or why the developer chose a particular approach. Even worse is when the code contains misleading comments. Worse still are comments that are outright incorrect because they reflect a previous state of the code or the developer didn’t actually understand why a technique works (the sheer dumb luck approach to coding).
Make sure you check out my article on the topic and get back to me about it. I’d like to hear your views on using the debugger as an educational aid. For that matter, I’d like to hear your viewpoint on debuggers as a class of application. Do you feel they need work or are debuggers as useful as they need to be? You may even feel that debuggers have become encumbered by way too many features. Whatever your viewpoint, let me know at John@JohnMuellerBooks.com.