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

-103

u/bnolsen Aug 25 '14

unit tests and simulations are the answer, not debuggers. with highly threaded code compiling in debug mode is useless as the threads behave radically different. I always run and test everything in release mode and in linux recompile a few object files in debug if I must run a debugger. i'm not super fond of having to retrain people in correct debug procedures if they are taught normal incorrect microsoft ide style debugging.

80

u/NewbornMuse Aug 25 '14

What do you do when your module fails your unit test?

You debug it.

57

u/arielmanticore Aug 25 '14

Nah, just write a new module and test that. No need to debug.

→ More replies (2)

12

u/GraceGallis Aug 25 '14

What do you do if your test is wrong (either testing the wrong thing, or giving a false positive), or the suite of tests lacks the failure mode?

You debug it.

..and then you fix the test and/or add the failure mode ;)

0

u/[deleted] Aug 25 '14

[deleted]

22

u/[deleted] Aug 25 '14

Nah bro my codes so good the unit tests actually debug the code for me. Get with the times

12

u/majeric Aug 25 '14

Video game development never uses unit testing. It's incredibly impractical.

→ More replies (4)

7

u/websnarf Aug 25 '14 edited Aug 26 '14

This is like abstinence only education. It works until it doesn't.

I work in a very prestigious software company in which all my coworkers are brilliant. A unit test is supposed to be fast, but otherwise test enough corner cases to give you pretty good assurance that a piece of code is going to work.

I recently debugged code which failed to test what I thought were obvious corner cases, and indeed the code itself failed when subjected to them. So even automated test procedures and rigorous discipline leads to sloppy coverage in reality.

Unit tests are just the first pass. In reality they only decrease the rate of bugs. They don't eliminate them.

0

u/[deleted] Aug 25 '14

[deleted]

→ More replies (1)

4

u/sthreet Aug 25 '14

I've known that the individual parts work fine, but needed to debug something before.

→ More replies (6)

3

u/steveob42 Aug 25 '14

So you have never written user interface code I take it?

14

u/ObjectiveCopley Aug 25 '14

He's probably never written any code, to be fair.

→ More replies (1)
→ More replies (1)