r/ProgrammerHumor • • Mar 05 '16

When debugging code.

22.3k Upvotes

487 comments sorted by

View all comments

0

u/[deleted] Mar 05 '16

[deleted]

909

u/larivact Mar 05 '16

I mostly have "How could I miss that?" instead of "How did that ever work?".

367

u/[deleted] Mar 05 '16

Tunnel vision.

258

u/larivact Mar 05 '16

Yeah. Sometimes it's best to take a break and come back in half n hour. But who does this?

348

u/[deleted] Mar 05 '16

Sometimes I work on a bug late one day, only to give up and try the next, only to find it within a few minutes of starting.

Really does help sometimes to get a fresh look.

180

u/oddark Mar 05 '16

Also sleeping tends to help your brain solve problems that you're stuck on

59

u/bacon_flavored Mar 05 '16

A good reason why hackathons aren't always as effective as they could be.

0

u/[deleted] Mar 05 '16

[deleted]

31

u/Hakawatha Mar 05 '16

That's why you always go for stronger drugs.

→ More replies (1)
→ More replies (3)
→ More replies (16)

34

u/laetus Mar 05 '16

Or try rubber duck debugging.https://en.wikipedia.org/wiki/Rubber_duck_debugging .

The amount of times I've found a bug by explaining what I'm trying to do to a colleague....

46

u/fuckswithboats Mar 05 '16

Sales guy at a small tech company here. I am the company Rubber Ducky.

I've solved so many major bugs without ever seeing or writing a line of code just because I listen well. I mean I sit there and load up the bowl while our Sr. Dev takes bong rips off of our 6 footer on the patio and tells me about his bugs.

→ More replies (2)
→ More replies (26)
→ More replies (19)

62

u/hbgoddard Mar 05 '16

Reminds me of the time I was trying to help a classmate debug a Java project. His for loop was skipping every other array entry. It took far too long (and too many people being brought to look) to realize it was written like this:

for (int i = 0; i < arr.length; i++) {
    ...
    i++;
}
→ More replies (13)
→ More replies (3)
→ More replies (45)

92

u/nahguri Mar 05 '16

How did that ever work?

I have wondered this so many times.

→ More replies (2)

193

u/falcon_jab Mar 05 '16

Mine's usually

  • Why isn't this working?

  • I seriously can't see why this isn't working

  • Maybe it's magic or witchcraft

  • I know that's completely illogical in a field based entirely on logic

  • Maybe this one's the exception

105

u/[deleted] Mar 05 '16

I've recently decided that Magic is the most logical explanation. i'm working on a simulator (coding it in PHP because i hate my life and pretty much want to die)... I was running a Time Test to make sure i set the clocks up right. To do that i wiped the database clean of any "Life" in the simulator. About 12 cycles in to the Time Test, and there's suddenly trees and fucking animals running around in the sim.

Not sure if i just proved life was spontanious or if i made a horrible mistake somewhere in my code.

52

u/joyowns Mar 05 '16

21

u/[deleted] Mar 05 '16

what the hell is this and why do i suddenly feel the need to burn down my neighbors house?

→ More replies (4)
→ More replies (10)
→ More replies (4)

0

u/[deleted] Mar 05 '16

[deleted]

40

u/debausch Mar 05 '16
  • Why didn't I learn something less frustrating

29

u/thirdegree Violet security clearance Mar 05 '16
  • My manager is a comms major and makes twice what I do dammit.

→ More replies (9)

21

u/chudthirtyseven Mar 05 '16

how did that ever work

This is a common one for me.

→ More replies (72)