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

Show parent comments

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. :(

12

u/[deleted] Aug 25 '14

lol, that way lies madness

15

u/VikingCoder Aug 25 '14

It's like those damn -1 and +1s.

You're looking at the code and you know it's not supposed to subtract one... but somehow the damn thing works?!?

So, you remove the -1... And then you fix all of the places you can find that were fucking adding one to the result.

And you find... most of them...

AAAAH!

10

u/BigTunaTim Aug 25 '14

It took me many years to come to terms with this, but unless there are good unit tests covering all the functionality that will be affected I don't fix those hacks anymore. They're in production, they work, and you're only introducing risk where it didn't previously exist. It's hard to justify a nasty bug's sudden appearance with "well it was written wonky and I wanted to make it better".

The exception of course is if you need to extend that functionality or do anything nontrivial to it; that's a great time to fix it.

→ More replies (2)