Live data from Hacker News

Why don't schools teach debugging? (2014)

danluu.com

161–170 of 174 posts

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

#161
post #95

It is a task that shouldn't be learned in university but in middle school. And it's not just useful to stem, it's useful to many things in life. E.g. a disagreement between two educated, smart people usually can be resolved by debugging how everybody got to their point of view and then flashing out the details. It's also how you figure out why the toaster isn't working any more, or why your wife left you. It's also a…

Your comment couldn't be more on point. I viscerally disagree with the direction that a lot of "coding" initiatives are taking in schools nowadays. The claim is that the intentional move away from actual computer science is that it is a way to attract more people. Fine. But when the course is just about making "whatever you want," then that really valuable time of learning these debugging skills gets missed, 'cause y…

"populace", not "populous" (an adjective meaning "highly populated").

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

#162
post #95

It is a task that shouldn't be learned in university but in middle school. And it's not just useful to stem, it's useful to many things in life. E.g. a disagreement between two educated, smart people usually can be resolved by debugging how everybody got to their point of view and then flashing out the details. It's also how you figure out why the toaster isn't working any more, or why your wife left you. It's also a…

I agree that these are the same skills. Outside of the programming context I would not call it debugging but rather just rationality or problem-solving. Some call it the scientific method, though that's not exactly the same thing.

In the debugging context there are some more specific applications of the general principles, which should also be taught.

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

#163

Earlier quoted context omitted.

Your comment couldn't be more on point. I viscerally disagree with the direction that a lot of "coding" initiatives are taking in schools nowadays. The claim is that the intentional move away from actual computer science is that it is a way to attract more people. Fine. But when the course is just about making "whatever you want," then that really valuable time of learning these debugging skills gets missed, 'cause y…

"populace", not "populous" (an adjective meaning "highly populated").

Won't let me edit, but thank you - I had no idea!

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

#164
post #89
post #76

Earlier quoted context omitted.

But I can't get them to integrate well with my dev tools. If, for example, I'm using something like babel/webpack/Typescript there is no easy way that I've found to for example just set breakpoint on a line of code in my editor/IDE and have the web browser debugger break when it gets there.

Not as convenient, but you can write the statement `debugger;` and the debugger will stop there.

I find it incredibly convenient because I don't need to go through the browser trying to find the same spot in the code.

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

#165

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?

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.

Oh, so a bug in the debugger basically. Speaking of the registers it sounded like he was talking about some weird cache incoherency issue that shouldn't conceivably exist (on x86 at least).

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

#166
Some schools are not just indifferent to teaching debugging, they are actively hostile to it, arguing that teaching debugging interferes with the "proper" approach of programming through correctness proofs.

This pernicious attitude, at least in my alma mater, could be traced back to E.W. Dijkstra, e.g.

http://www.cs.utexas.edu/users/EWD/transcriptions/EWD02xx/EW... http://www.cs.utexas.edu/users/EWD/transcriptions/EWD03xx/EW...

And he may not have been entirely wrong; it's not uncommon to see people spend insufficient time on reasoning about the correctness of their code from first principle, and jump directly into testing/debugging.

On the other hand, using correctness proofs as the sole and sufficient means of writing code is just not a workable approach for most non-trivial problems.

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

#167

Earlier quoted context omitted.

I find a good logging library will help me narrow down the issue before I enter the debugger to watch what the system is doing. If I'm 90% sure I know what the bug is and it's a system where it's easier to add a print than to enter the debugger (yes, those types of systems exist), I'll do that first.

Systems where debuggers are difficult to access totally exist, of course! But, IME, they're pretty rare by comparison (unless you've footgunned elsewhere). Whether it's something like `pry` in Ruby where you can open a REPL on command or a JVM where you connect with an external debugger, most systems are flexible enough to work with you. If you've written something in a language where you don't have a debugger...that…

> Systems where debuggers are difficult to access totally exist, of course! But, IME, they're pretty rare by comparison

It's often hard to run a stepping debugger when you have an embedded hardware at hand. It's equally hard to run such a debugger when you have multi-threaded code. And the same stands for virtually any system that works with network directly, where timeouts are plentiful.

Also, good luck with a debugger in this modern architecture of microservices that happens to be hype nowadays.

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

#168
post #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.

I hear you. The general reaction of the class was, "Thank you for nothing."

The real world is different.

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

#169
post #105

What schools DON'T teach debugging? Simple trace statements were one of the first things we learned in 101. Maybe I was just lucky to have a good teacher. I still remember him not liking my solution to a problem when I was extremely proud of how smart I'd made an object, so that it reacted properly based on whatever was passed in. Instead of arguing with me he offered an extra credit assignment to take all of the log…

It's the first time I hear that anybody got taught debugging, honestly.

That's a little bit horrifying.

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

#170
post #153
post #135

Earlier quoted context omitted.

I never got military education, but I have to say I admire how well military personal can respond to problems. Anybody have insights how they get educated and if that could be applied to programming/debugging as well?

Once an officer hits their unit, they have someone with 5-10x more experience to supervise them for their first 5-10 years. It would be like a new manager getting a senior engineer to work with 7 days a week to help guide their bad ideas. Additionally, your software engineers aren't indentured servants. In the military, you often can't go home until a problem is fixed and if you quit, you go to jail. The military bur…

That doesn't matter, though. What I'm talking about is that you can throw a granade next to a soldier, and he'll still be able to think and make decisions. That means he got trained to not let his amphibian brain take over when under stress. That's in some regards what you need if you want to learn debugging. Don't the stress of the too complex problem stop you from thinking. Go step by step.

I bet you can teach that without all the bad associations people have about the military.

Post reply on HN