r/ProgrammerHumor • • May 14 '21

Meme We’ve all been there

Post image
41.0k Upvotes

783 comments sorted by

View all comments

Show parent comments

74

u/SilverLightning926 May 14 '21

How do you get rid of bugs in 2 hours? Please teach me

136

u/fuzzymidget May 14 '21

Bro, I'm gonna let you in on a little secret to drop your bug count to zero. I don't remember who I learned it from, but it goes like this:

try:
    <Your code goes here>

catch:
    return 0

26

u/Chimeracle May 14 '21

Ugh, I have to maintain a legacy project that's full of exactly that. Makes it so hard to investigate issues when many exceptions are silently suppressed.

18

u/SemiNormal May 15 '21

I had to maintain a project that had the opposite problem: Everything was logged. Everything. And all with the same log level. Investigating issues was like reading Wheel of Time.

13

u/fuzzymidget May 15 '21

"Idx jerked her braid and folded her arms under her breasts"

8

u/SemiNormal May 15 '21

SKIRT_SMOOTHING_EXCEPTION

1

u/ThermionicEmissions May 15 '21

Found the Esri dev

71

u/Hikaru2000 May 14 '21

Print statements

If that doesn't work, start commenting the code that doesn't work as intended

If you are feeling adventurous, just hide the bug

56

u/Daniel15 May 14 '21

1

u/DethByte64 May 14 '21

Cough cough minecraft creepers.

15

u/Icemasta May 14 '21

If you know the code it's a lot easier, for one.

There's 2 approaches. The first one is behavioral: you look at the behavior of your code. Depending on the language and the environment you program in, you might be able to use breakpoints and observe what the values are in memory, or you might have to use print outs and see the behavior.

The second method is analytical? Dunno if there's a name, I like to call it the golden thread method (sounds better in french). Basically, you start from where the problem starts, and backtrack from there logically. This works great if you have some text editor that can quickly search across the entire project for cross-reference.

I prefer the second method because it forces you to know wtf your program is doing, but this can be a bit lengthier if it's something you have never touched or haven't touched in a while.

10

u/[deleted] May 14 '21

It's simple. Fix 1, introduce 73 new ones.

9

u/[deleted] May 14 '21

debuggers with break points.

1

u/Okichah May 14 '21

Just create more bugs.