Live data from Hacker News

Why don't schools teach debugging? (2014)

danluu.com

41–50 of 174 posts

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

#41
post #34

> why schools don’t teach systematic debugging. It’s one of the most fundamental skills And herein lies Dan Luu's fundamental misconception: that universities see themselves as places where students come to learn skills , i.e. as places of certification producing skilled workers for industry. Most universities see themselves as academic places of learning for the pursuit of knowledge for knowledge's sake, which only…

I respectfully disagree with your argument in relation to this article.

Dan Luu is describing a method that would help people achieve a better success in their exams and classes, he's not even pointing their usefulness in the workplace. Therefore, your point about him thinking that universities are here to produce skilled workers is a strawman.

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

#42
post #13

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

I KNOW I'm better at debugging than at programming. My own working code is terribly simple and straightforward but I've fixed kernel sound drivers, buggy firmwares and complex interrupt-driven music players. Perhaps I find it easier to construct a mental model when presented with a finished system rather than when starting from scratch.

I think you have touched on something important - you need a good mental model of the system being debugged.

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

#43

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

> debuggers will often lie to you, and you often have to look into the registers for the real data What do you mean by this?

Well I don't know what OP meant, but I work in games programming, and the PS4 debugger will frequently lie to you in visual studio. You hover over a variable and it's just giving you a completely wrong value, which is correct if you look directly into memory window or assembly view.

I wouldn't consider this to be a very common use case though, it's a niche within niche.

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

#44

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

> debuggers will often lie to you, and you often have to look into the registers for the real data What do you mean by this?

Debuggers sometimes simply write wrong values into those nice gui-windows- do not update the values they show, or just dont inform the reader that the value ceased to exist- at all.

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

#45

Earlier quoted context omitted.

> debuggers will often lie to you, and you often have to look into the registers for the real data What do you mean by this?

Well I don't know what OP meant, but I work in games programming, and the PS4 debugger will frequently lie to you in visual studio. You hover over a variable and it's just giving you a completely wrong value, which is correct if you look directly into memory window or assembly view. I wouldn't consider this to be a very common use case though, it's a niche within niche.

Its that way in all the niches, which makes it a set of all niches ==> mainstream thing.

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

#46

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

> debuggers will often lie to you, and you often have to look into the registers for the real data What do you mean by this?

[deleted]

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

#47

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…

Circle has no volume

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

#48

Earlier quoted context omitted.

Well I don't know what OP meant, but I work in games programming, and the PS4 debugger will frequently lie to you in visual studio. You hover over a variable and it's just giving you a completely wrong value, which is correct if you look directly into memory window or assembly view. I wouldn't consider this to be a very common use case though, it's a niche within niche.

Its that way in all the niches, which makes it a set of all niches ==> mainstream thing.

Optimised C++ sure but you don't see this issue with C#. If you are using a high-level language that does not have a reliable debugger, time to change language.

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

#50
There are a number of ways one could teach debugging. There are for example a number of CTF challenges with reversing that can be used to train persons in using debuggers to find and fix issues. The good thing with CTF challenges is that they have clear goals (find the flag) so you know when you are done.

Another way which we have used is to engage students in open source projects. Look at bug trackers to find a few issues and then try to solve them. This also teaches students a lot of other things like: - How to work in existing projects - How to ignore large parts of a code base to focus on a given issue - How to write test cases - How to create patches that match project code style - How to communicate and participate in projects.

Post reply on HN