Live data from Hacker News

Why don't schools teach debugging? (2014)

danluu.com

51–60 of 174 posts

Re: Why don't schools teach debugging? (2014)

#51
post #4

This 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…

That wiki link is a fascinating rabbit hole for debugging related advice/pages. Also I'd never heard the term half-splitting, Cheers

Half-splitting is a binary search for the root cause.

Re: Why don't schools teach debugging? (2014)

#52
I think the Feynman Method is equally applicable to debugging; I've also done some teaching before, and seen far too many beginners open the debugger at the first bug they find and start stepping aimlessly through the code, seemingly unaware of what their code should be doing. They eventually reach the point where the program outputs the wrong result, and have no better understanding of what they did wrong, because they were too focused on what the code is doing to think about what it should be doing. I call it "debugger-induced tunnel vision".

My advice on this is to, before even thinking about using a debugger, think carefully about and write down if necessary the conditions and values expected at certain points in the code. Then, and only then, should you use the debugger to confirm or deny those hypotheses. In practice, with those I've taught, guiding them through this procedure, they often realise the source of the bug before using the debugger.

Re: Why don't schools teach debugging? (2014)

#53

When asked "How do you debug programs?" my Programming Languages professor responded, "I don't. I prove every line correct before I write it."

This can be done in the context of algorithms but not in professional programming in general. Software has dependencies with zillions of components. If you want to formal proof everything, the software field would move like a turtle, with wisdom but very slow.

Re: Why don't schools teach debugging? (2014)

#55

Earlier 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.

Is an ML course now a common part of an undergraduate degree program, though? --I genuinely don't know, which is why I'm asking. These days it would certainly be much easier to teach students how to use a debugger - most students probably aren't doing their work on mainframes anymore where resources might be limited (anyone else remember getting emails asking you to release your semaphores because the server is runni…

Edit: skim-read GP, got the wrong ML.

I touched on the PL ML in a type systems course. I can't speak for how common it is though. It's certainly much more likely for someone who takes a course on type systems or PL theory though, presumably given that choice it's pretty common.

--

> Is an ML course now a common part of an undergraduate degree programme​, though?

There were several available to me. It's​ not really a particular interest of mine, but I took an introductory course anyway, since it would have seemed a bit remiss in today's world to have graduated without knowing an NN from an SVM.

Unfortunately for my grades, performance usually reflects interest... I still don't think I actually regret it though.

Re: Why don't schools teach debugging? (2014)

#56

I 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…

> Anything that has one right answer is going to smell like a made-up classroom assignment. 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 yo…

4 / 3 would be computed as an integer (eg. 1), before the result is implicitly coerced to float for the rest of the expression calculation?

A nice example for debugging, and for understanding the value of languages with better typing discipline.

Re: Why don't schools teach debugging? (2014)

#59
> the problems were caused by not having an intuitive understanding of, for example, the difference between f(x+a) and f(x)+a

Does the author really advocate that the instructor of advanced college course needs to spend his time on explaining the difference between f(x+a) and f(x)+a to his students?

I don't have any idea how someone with such an understanding of algebra could even get into a college even if he wanted to learn humanities. If a college student doesn't get it, it's the college mission to fail him as fast and possible, not to spend time trying teach him something middle school should have.

Post reply on HN