Why don't schools teach debugging? (2014)
11–20 of 174 posts
Re: Why don't schools teach debugging? (2014)
#12This can really be extended to basic troubleshooting skills, and goes beyond software development -- beyond technology, even. Troubleshooting is really just a special application of general 'problem solving', which is something schools aim to teach. I'm not sure why troubleshooting skills are not taught, especially something like "divide and conquer" [1]. Even in very complex systems, so long as you have the right ac…
Re: Why don't schools teach debugging? (2014)
#13Re: Why don't schools teach debugging? (2014)
#14In school, you're always told to show your work. I'm sure a lot of us here tended to be among the smartest in your class, at least before university, and we often thought having to show our work was silly. That's why a lot of us get tripped up when it comes to the type of debugging the author is talking about (it certainly still happens to me sometimes). Showing our work reminds us that solving problems is an iterati…
I just think debugging is art and parcel of programming. Debugging should come up in the first practical exercise in a Graphics 101. It should come up the first time you do an ML assignment in Programming Languages. Its absence in any course is conspicuous. But at the same time more than half of the professional web developers I know don't really use a debugger. Equally problematic.
I wonder how much that has to do with tooling? When programming in python I run everything in a debugger basically all the time. When doing JavaScript front-end work it's back to print debugging.
Re: Why don't schools teach debugging? (2014)
#15I have always felt that I was better at debugging than programming :-) I have often been able to debug really complex problems but afterwards I am not able to retrace the steps that I took to come up with the diagnosis - so I'm not sure if this skill can be taught.
Re: Why don't schools teach debugging? (2014)
#16I served as a TA on that course for the first few years, and after the first year, I lobbied for a few adjustments. The most important one was to include a specific assignment on debugging, where instead of asking the student to implement a new program, an existing program is presented that has both syntax and semantic errors. Students are expected to turn in a list of all the errors that they find.
[1] A crash course, actually, but still way better than nothing.
[2] Nowadays they do Python, I hear.
Re: Why don't schools teach debugging? (2014)
#17Earlier quoted context omitted.
I just think debugging is art and parcel of programming. Debugging should come up in the first practical exercise in a Graphics 101. It should come up the first time you do an ML assignment in Programming Languages. Its absence in any course is conspicuous. But at the same time more than half of the professional web developers I know don't really use a debugger. Equally problematic.
But at the same time more than half of the professional web developers I know don't really use a debugger. Equally problematic. I wonder how much that has to do with tooling? When programming in python I run everything in a debugger basically all the time. When doing JavaScript front-end work it's back to print debugging.
In these cases, the Feynman method is sometimes all that you can apply. I have already spent plenty of hours with a stacktrace on one screen and the source code on the other screen, stepping through the source code in my mind (usually backwards from the end of the stacktrace).
Re: Why don't schools teach debugging? (2014)
#18> those who were underperforming weren’t struggling with the fundamental concepts in the class, but with algebra: the problems were caused by not having an intuitive understanding of, for example, the difference between f(x+a) and f(x)+a. Those taking that class have spent years trying to learn algebra and still don't get it so we are already trying this. > I’m no great teacher, but I was able to get all but one of t…
Re: Why don't schools teach debugging? (2014)
#19I imagine it would be quite hard to come up with good debugging examples for a class. Anything that has one right answer is going to smell like a made-up classroom assignment. The thing that makes debugging hard is multiple hypotheses (or amazingly, exhausting all hypotheses). Your crash can be caused by errors on many different abstraction levels, so your debugging process has to be thought about on many levels. On…
If you're doing C (or any other language where that particular problem exists), it's always a nice exercise to have students write a program (or a function) that takes the radius of a circle and outputs its volume. Most students will write:
double volume(double radius) {
return 4 / 3 * M_PI * radius * radius * radius;
}
Can you see the problem? ;)Re: Why don't schools teach debugging? (2014)
#20I imagine it would be quite hard to come up with good debugging examples for a class. Anything that has one right answer is going to smell like a made-up classroom assignment. The thing that makes debugging hard is multiple hypotheses (or amazingly, exhausting all hypotheses). Your crash can be caused by errors on many different abstraction levels, so your debugging process has to be thought about on many levels. On…
> The thing that makes debugging hard is multiple hypotheses (or amazingly, exhausting all hypotheses).
You don't have to start out with an example that features all possible error conditions. It's totally fine to use a made-up classroom assignment for teaching. There is no need to put all the complexity in a single example, better to partition it into steps that can be attempted individually.
Moving around in a debugger, setting breakpoints and watches, knowing where to set breakpoints and watches, tracking a value on its way through the program, adding logging to get a view of varying state over time, localizing a problem within a large code base. Those are all skills that build on top of each other, and can and should be learned over a series of successively more complex examples, each focusing on a particular aspect, while reinforcing the previous lessons.
Then you can let the students loose on a wild goose chase through dozens of libraries calling into each other across language boundaries using asynchronous communication, to find the one instance where someone cast a void* to an int* to do arithmetic on it, when it should have been a float* .