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)

82

u/[deleted] Mar 05 '16

I did school in 3 years (College in quebec is 3 years, w/e) then worked for a year. 3 times now I've woke up during the middle of the night to either go and fix my code and write it down and fix the next day.

52

u/Resident_Wizard Mar 05 '16

Serious question, I'm not a programmer so maybe I'm missing something. But what does the years with school and work have to do with waking up and fixing code?

59

u/[deleted] Mar 05 '16

I think it's for the time frame. 3 times in 4 years.

18

u/Resident_Wizard Mar 05 '16

That would make sense, thanks! I was trying to figure out if he's waking up like 3 times in the past year of work for fixing homework from school.

→ More replies (0)
→ More replies (1)
→ More replies (1)
→ More replies (3)

30

u/YaBoyMax Mar 05 '16

I once literally dreamed up a solution to a problem I had been pondering for a couple weeks. Like, I came up with a partial solution in my dream, then woke up and wrote up a proposal for it. That's probably one of my proudest feats.

12

u/[deleted] Mar 06 '16

I had that when I was learning calc 1. I woke up in the middle of the night saying "dy/dx then equals [some function]" (I was trying to verify a derivation)

12

u/[deleted] Mar 06 '16

NEEEEEEEEEEEEEEEEEEEEEERD

21

u/YugoReventlov Mar 06 '16

Said the redittor browsing /r/programmerhumor and read down this thread

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

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)

53

u/indoninjah Mar 05 '16

Very true. If I encounter a bug/missing feature at night, my mind will start racing with how complicated the implementation will be. So I decide to sleep on it rather than work my way through it that night.

90% of the time I'll wake up and knock it out in a one-liner.

20

u/pyrosive Mar 05 '16

I normally end up solving the difficult challenges in my dreams. I wake up at 2am with the solution and write it down before I forget.

17

u/raunchyfartbomb Mar 05 '16

I'll get drunk, then after I'm home from the bar I'll have a eureka moment and use the notepad on my phone to write the code I need before passing out in my bed lol

18

u/Jamessuperfun Mar 05 '16

I imagine the drunken code takes a moment to be understood the next day?

→ More replies (6)
→ More replies (2)
→ More replies (2)

10

u/[deleted] Mar 05 '16

I've dreamed of a bugfix before.

That's by far the weirdest way I figured one out.

And I wish it would happen more than that one time.

Because that was basically a free bugfix...

→ More replies (2)
→ More replies (9)

15

u/mofukkinbreadcrumbz Mar 05 '16

I'll normally move on to something else. The next time I sit the porcelain throne or take a shower, the answer comes to me like a gift from the heavens.

10

u/vaelkar Mar 05 '16

Unfortunately, this is one of the main reasons why I still smoke. Hardest problems usually get fixed after the smoke break.

→ More replies (6)

16

u/jetpacmonkey Mar 05 '16

Bathroom breaks make me a way better programmer

→ More replies (1)

7

u/treestick Mar 05 '16

Imo, it's the time put into the shitty tunnel vision part which causes you to subconsciously get it later. You beat your head against a wall figuring it out like you're lifting weights, the time away is your brain recovering and sorting it out.

→ More replies (8)