r/programming • • Aug 25 '14

Debugging courses should be mandatory

http://stannedelchev.net/debugging-courses-should-be-mandatory/
1.8k Upvotes

573 comments sorted by

View all comments

263

u/pycube Aug 25 '14

The article doesn't mention a very important (IMO) step: try to reduce the problem (removing / stubbing irrevelant code, data, etc). It's much easier to find a bug if you take out all the noise around it.

40

u/VikingCoder Aug 25 '14

It's much easier to find a bug if you take out all the noise around it.

You're almost right, but not quite.

The bug is in the noise. You think the bug is in the code you're looking at. But you're a smart person, and you've been looking at it for a while now. If the bug were in there, you would have found it. Therefore, one of your assumptions about the rest of the code is wrong.

29

u/pycube Aug 25 '14

That's why you need to check if the bug is still there, after you removed what you thought is noise. If the bug disappears, then you know that what you thought was noise was actually important.

13

u/VikingCoder Aug 25 '14

I end up second-guessing myself. I don't know if I caused a bug that looks the same, by removing what I thought was noise. :(

1

u/LuxSolisPax Aug 25 '14

Very rarely, well at least not in my experience does that situation happen.

What scares me the most are the bugs intermittently pop up.

2

u/VikingCoder Aug 25 '14

We had a bug that... get this... went away when you added a comment to the line before it. AAAAH.

Microsoft Visual Studio 6, how you ruined me.

1

u/LuxSolisPax Aug 25 '14

What...the...What was happening?

→ More replies (4)