Live data from Hacker News

Why don't schools teach debugging? (2014)

danluu.com

151–160 of 174 posts

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

#151
post #112

I haven't seen anyone mention the following yet, and it's INCREDIBLY important! When something is not working right and you have to debug it, you need to re-evaluate your abstractions and drop down a level in your technology stack. In Dan's case, he had to look at, and think about how the logic gates worked. In a more modern case, when your REST calls aren't working right, you may have to debug HTTPS stuff. If your H…

IMO debugging is actually the most practical definition of the buzzword-y "full stack" developer.

> There's no authoritative definition, but I see it as "I can trace a visual problem down through CSS styles, debug the JavaScript code that sets them, intercept the AJAX call with the problem-data, debug the backend language that is run, diagnose the SQL that finds the malformed row... And apply a fix on any of those levels where it is needed."

> You might not like the code you wade through, but...

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

#152
post #133

Earlier quoted context omitted.

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.

Whatever "coded" the universe did it more than a few thousand years ago.

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

#153
post #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?

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 burns through a lot of good people, most get out after their initial term.

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

#154
post #31

Well, not only debugging but also performance profiling.

Debugging is much more important though.

If you had to chose between both, sure.

But I think there might be some time to at least walk students through the basics of profiling, it can be very valuable to have some exposure.

Then when it comes to memory management, there's a fine line between debugging and profiling.

I was playing with left leaning red-black binary trees yesterday as a refresher and got a memory corruption due to a bug. With valgrind (a tool I generally use to catch memory leaks) I caught it immediately, very helpful tool.

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

#155
post #11

At UC Berkeley, we are planning a lab devoted to practical debugging for next year's Data Structures course. Your ideas/suggestions are appreciated!

Make sure it comes after a few rigorous lectures and exercises on requirements and specifications. I presume from the name of the course that there is already at least some emphasis on that.

If not students will conclude that writing the spec. and debugging the program are simply equal valued steps in a stepwise refinement process. Of course it sometimes is that way and can be no other, but generally it is better to think first and act afterwards.

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

#156
post #82

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…

> I imagine it would be quite hard to come up with good debugging examples for a class. Here's a high-level idea that might be doable in the right circumstances. Get one or two hardware guys from an engineering company near the institution to come out with an old version of their silicon that has a fairly rapidly (but not necessarily trivially) triggerable bug. Set the system up, run over how it works, explain the in…

Sadly, late breaking (post silicon or just late in development process) bugs aren't generally particularly more exciting in terms of debugging than earlier ones - other than the urgency/annoyance and rarity, of course.

They do tend to be 10x as annoying to debug though. Not more difficult - just tedious - especially because you often end up triaging what turns out to be somebody else's bug (i.e. a checker on your block fails, so you need to trace it back to somebody else, and often they also trace it outwards to somebody else).

And this is where using it as a class example gets really difficult - even people on the design team are specialists in their own blocks. Giving students all the knowledge they'd need to debug a problem would be incredibly difficult.

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

#157
post #32
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.

In many ways, the tooling around web development is far superior to other languages (e.g. golang with delve). Most browsers ship with excellent debug tools. The caveat obviously being that debugging code written using some JS frameworks, like Polymer, is a nightmare.

That's it. Declarative asset compilers like Webpack break debugging. Transpiling breaks debugging. Convention-over-configuration frameworks and tools like Ember break debugging. Other declarative APIs like promises and and virtual DOMs break debugging.

PHP and JavaScripy are great for debugging. Even Node is awesome. Rails and mainstream JavaScript frameworks... not so much. Nothing about the languages.... The people who design the frameworks and build tools just don't seem to value it.

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

#158
post #11

At UC Berkeley, we are planning a lab devoted to practical debugging for next year's Data Structures course. Your ideas/suggestions are appreciated!

Based on a job at my workplace that could be available for your students, this is practical:

Make them use a JTAG debugger such as the Ronetix PEEDI. Make them debug timing-sensitive boot code, such as SDRAM detection routines that use GPIO pins to bit-bang SMBus protocol to the SPD EEPROM. Have a hardware watchdog enabled when this code is hit; it should reset the CPU after a few seconds.

Another suggestion is to use the debugger that is included with IDA Pro. Make them connect IDA Pro to a remote system, then debug a kernel driver without source code. The "trace replay" capability may come in handy.

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

#159
post #55

Earlier quoted context omitted.

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…

Yeah, I was referring to MetaLanguage, not Machine Learning.

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

#160

Earlier quoted context omitted.

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

Yes! I've been saying this forever -- debugging is a science. The best way to find and fix the toughest heisenbugs is to a) form a hypothesis as to what might be happening, b) figure out what would falsify your hypothesis, c) run an experiment that must make the bug happen reliably iff your hypothesis is correct, and finally d) figure out the solution. Steps a-c are precisely the scientific method.

Exactly. Debugging is just the application of the scientific method (or rationality) to a specific domain. I have been beating this drum for years now...
Post reply on HN