Live data from Hacker News

Why don't schools teach debugging? (2014)

danluu.com

131–140 of 174 posts

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

#131
post #85
post #14

Earlier quoted context omitted.

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.

I almost always start with thinking about where the bug is likely to be, then doing some print/log debugging to confirm or reject my suspicions. I find it pretty effective and simple to do. Debuggers are complicated and create dependency. How many developers do you see every day just sitting at their computer tapping "step" ... "step" ... "step" for hours. I'll break out a debugger if all else fails, but it's not my…

> How many developers do you see every day just sitting at their computer tapping "step" ... "step" ... "step" for hours.

Er...very few? A bad programmer will be a bad programmer with a debugger and that bad programmer will be a bad programmer who prints out state after every line of code.

Breakpoints and watches are strictly superior to print statements for understanding the system you're working with. You drop a breakpoint where, as you yourself put it, "the bug is likely to be," you look around, you kill the process and you make a change. It doesn't "create dependency", it's just better at solving the problem. Anyone can fall back to println debugging if necessary. It's not some difficult thing. But it's wasting your time.

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

#132
post #104

Earlier quoted context omitted.

His point is that university is here to produce/teach knowledge. Skills should be learned elsewhere, e.g. in schools prior to that. The university's official language is also a skill that is very important to the student's success, but the university is not responsible to teach this language skill. You must have it to enter university.

Then I bieleve the argument still stands. Universities would teach knowledge better if they spent a comparatively tiny amount of time teaching appropriate skills, as it would get students ready to learn. The author demonstrated this point by showing how his classes could help students learn better. We can then debate about whether having successful students is a positive thing to have for universities, but Dan Luu cl…

That's a valid additional point. I'd also say that they should at least offer optional courses with skills. That also applies to language. While universities don't offer a major in English speaking/writing, many have opportunities for second language learners to improve their English skills.

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

#133
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…

Agree in principle. Another way of putting it is, debugging is another word for applying the "scientific method." E.g., experimental vs control group is a useful concept in debugging

I also think that the scientific method and debugging have a lot in common. One coul say scientists debug what god coded a few thousand years ago.

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

#134
post #85

Earlier quoted context omitted.

I almost always start with thinking about where the bug is likely to be, then doing some print/log debugging to confirm or reject my suspicions. I find it pretty effective and simple to do. Debuggers are complicated and create dependency. How many developers do you see every day just sitting at their computer tapping "step" ... "step" ... "step" for hours. I'll break out a debugger if all else fails, but it's not my…

> How many developers do you see every day just sitting at their computer tapping "step" ... "step" ... "step" for hours. Er...very few? A bad programmer will be a bad programmer with a debugger and that bad programmer will be a bad programmer who prints out state after every line of code. Breakpoints and watches are strictly superior to print statements for understanding the system you're working with. You drop a br…

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.

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

#135
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 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?

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

#136

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

I think avoiding what you call "debugger-induced tunnel vision" can be done by using a debugger to step through the code just to read it, debuggers can also be tools to better understand what the code is really doing because you not only see the code but also the state the system is in while debugging.

The added benefit is that when you actually break out the debugger to squash a bug you better understand what might be going wrong as you can try and pattern match from the time it worked perfectly.

I treat the debugger as a tool for understanding code, buggy or otherwise, no "debugger-induced tunnel vision" for me, it widens my field of view :)

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

#138
post #8

Earlier quoted context omitted.

as long as you don't copy paste code That's the million dollar question: how do you know whether a classmate is being earnest or just copying you? Especially in highly competitive environments, cheaters are extremely adept at leveraging your work without substantially contributing anything back. The way it works in law school is that students (at least the social ones) break up into study groups early on. They may or…

That sounds like awful pressure to not rock the boat of your study group but maybe it's suitable for lawyers. Cheating was solved in an engineering class I took that had us write a program in our own time, but the assessment was a test where we were asked to modify it and produce the correct output. If you had copied the code without understanding it, you wouldn't be able to pass the test.

A rigorous honor code also solves the cheating problem, as long as the administration actually enforces it by expelling violators.

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

#139

Earlier quoted context omitted.

> How many developers do you see every day just sitting at their computer tapping "step" ... "step" ... "step" for hours. Er...very few? A bad programmer will be a bad programmer with a debugger and that bad programmer will be a bad programmer who prints out state after every line of code. Breakpoints and watches are strictly superior to print statements for understanding the system you're working with. You drop a br…

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's your own damned fault. :-P

Post reply on HN