tags:

views:

705

answers:

22

What was the weirdest (or most awkward) time and place that you've found yourself thinking about a programming problem?

+16  A: 

In the toilet, while taking a dump.

Ironically, this always works, sometimes solving problems I've been battling for a few days already.

I guess the silence and solitude helps clear the mind. LOL.

===

UPDATE: Marking this as Community Wiki. Don't wanna gain repu on something as crappy as this!

Jon Limjap
+1: happens to me all the time :)
Ruben Steins
TheSoftwareJedi
Don't take one of mine, there's only 4 left and the weekend is coming.
I greatly agree. Sometimes when stuck on little problems, A little trip to the bathroom is all I need to work through it.
Kibbee
+1  A: 

For me it's when I go to bed.

I'm not even near my code, and I shouldn't be thinking about it anymore, yet sometimes that's where I think of the solution.

barfoon
+9  A: 

That's the classical 3B situation: Bus, Bed, Bathroom

Although the worst of all is getting some solution while going to Bed. You know that you won't be able to sleep at least before jotting it down somewhere.

Rinat Abdullin
Oh, sleep! When you said "bed" I thought you meant something else.
Daniel Paull
Well, the alternative "subway, sleep, shower" works too =)
Zach Scrivena
Depends on the city infrastructure) We don't have subways in Ufa)
Rinat Abdullin
+3  A: 

As a developer with ADD, there are a lot of strange places I think about "inapropriate" things:

  • while playing with the kids
  • while having diner
  • on the bike
  • during a game of d&d
  • while answering questions on stackoverflow
  • while watching a movie

But the winner is definitely reserved for the moments I won't supply any more details.

Gamecat
I think we can guess! That's one way to keep the wolf from the door.
Abizern
+7  A: 

In my dream. :)

Early on in university I found myself struggling with a programming assignment. After I went to bed I spent the whole night in what I can only describe as a state of half sleep...I was sure I was asleep but I felt strangely conscious as well.

I coded and debugged my assignment all night and barely got any rest.

The weirdest part is that when I woke up I was able to head straight to my computer and solve the problem in a few minutes.

From that day onwards I vowed never to let myself get that consumed on a programming problem again. its better to get a good night's rest and look at the problem with fresh eyes...even if you can solve problems in your dreams..

mezoid
Its not all bad, dream-solving can be more powerful. I hate the debug phase tho, the stack is never consistent. :p
Kent Fredric
Yep, has happened to me several times too.
some
Never works for me... The solution seems good in the dream but once woke up I realize it is just stupid :p I hate those dreams that give a false joy :(
Vinze
Yeap, have solved and debugged problems in my dreams before. Woke up, applied the dream thought, and it works!
icelava
I find syntax errors in my dreams ...
C. Ross
A: 

When I'm asleep, going to the loo, lying in bed awake ... or in fact last night worked something out while at a Carol concert :-)

WestDiscGolf
+4  A: 

Snowboarding down Col Du Plan on Aiguille De Midi, Chamonix, France. Had left work a few days earlier with an unsolved issue. I wasn't thinking about it, but the solution just came anyway.

That shouldn't happen, at least not on Col Du Plan.

krosenvold
while executing a rodeo 540???
icelava
I'm impressed you could safely ski that with less than 100% attention.
Uri
It was one of those smooth days with a nice layer of fresh snow. I'm not sure about the attention distribution, but there was obviously some subconcious percentage not snowboarding. There are quite a few places in xhamonix that are a harder than the glacier, and your fear levels adjust (un)fortunately. I still remember my first walk across the ridge right after the gondola.
krosenvold
+9  A: 

Not so weird: taking a shower. I've come up with some creative ideas there. The problem is only that sometimes I forget them before I could write them up... argh! :-)

It seems that I'm not alone, Scott Adams (creator of the Dilbert Comics):

Mr. Adams gets most of his ideas while in the shower. The bathroom door is closed when it happens, so there are two possible sources. Either the ideas are contained in the clean, chlorinated water that comes from the showerhead, or they emanate from the public sewer system and waft up through the drain. Judging from the quality of Mr. Adams’ ideas, I think we can rule out the showerhead.

Sincerely, Dogbert

Scott Adams - Dilbert

splattne
Showers are great in that sense. You get to spend a lot of time alone with white noise and no distractions.
Uri
+1  A: 

In addition to the 3Bs mentioned above, the other time I think of solutions to difficult problems is when I'm doing other more mundane coding, which makes the current work even more boring.

Shane MacLaughlin
+3  A: 

At a dinner party with my girlfriends parents...

I actually got an "Are you ok? You seem distracted" by her mother.

My instinctive response was ".. yes.. I'm just thinking... about this problem".

They might think I'm weird.

shoosh
"They might think I'm weird." - I guess they are right. ;-)
splattne
+15  A: 

While my wife was in labour.

This isn't so much "solving a programming problem" as "programming in a hurry" but...

Just over five years ago, my wife went into labour and we found we didn't have any digital watches - just analogue ones which didn't even have second hands. Obviously I helped Holly during the contractions, but then between contractions I wrote a quick and dirty WinForms "contraction timer" which logged the duration of the contractions as well as the time between them. The user interface was a big, easily-clicked button saying "start" or "stop".

I was going to update this to a voice-activated v2 for our second child, but it turned out to be twins - birth was via a C-section, and Holly was in hospital well before the birth anyway, so it wasn't needed. Might write it anyway some time - a friendly application keeping track of things for you is a lot nicer than trying to write down times etc.

Jon Skeet
I'm sorry, but this is such a "Jon Skeetism". For geek points - did you write the tests first?
Abizern
Im waiting for the Skeet facts book :-P
Artur Carvalho
Oh. My. God. I've coded myself little toy programs for the kids, but NOT BEFORE THEY WERE BORN!?! ;-)
splattne
This is a lovely story :) Mr Skeet, you truly are one of a kind.
DoctaJonez
I can't believe this story didn't come out when the whole "Jon Skeet Facts" thing was going on. :)
Bill the Lizard
@Bill: Yeah, I nearly wrote a separate answer of *genuine* silly facts - things like this and the robe/dressing-gown incident. I decided it didn't really fit in with the rest of the answers though.
Jon Skeet
You. The Geek. You Win!
icelava
Probably worked much better than my iPod. I crashed the stopwatch on my iPod after only 5 or 6 contractions.
Kibbee
A: 

When I was on the other side of the world and meant to be on holiday.

I was backpacking around Europe when I came up with the theories that I used an iPod wripper I wrote.

I was away from any kind of computer or anything.

Slace
A: 

On more than one occasion when I've been ill, I've been lying in bed in a bit of a daze thinking my illness must be some sort of software bug, and if only I could debug my stomach / head / whatever then it would go away.

As for real software problems, I tend to get good ideas while washing up after dinner.

jrb
+1  A: 
  • Middle of a sentence. I stop speaking and then I usually hear a distant "Are you ok?"
  • While driving. I put the auto pilot on and always miss my exit.
Artur Carvalho
While driving the kids to school I have been known to miss the turning because I've just worked out how to solve the problem I was working on yesterday.
Swinders
+1  A: 

I've been coding assembly language for VJ visual in discotheques...

So I had to solve programming problems during techno parties after drinking lot's of vodka...

Think Before Coding
A: 

While driving to and from work is where I tend to find myself thinking about coding problems.

Usually while I'm in a queue though as I'm concentrating on the traffic when actually moving. Guess I'm just giving my brain something to do while the car is ticking over and the lack of interruptions must help.

Swinders
A: 

During my sleep. Sounds crazy, but I’ve often found myself writing and compiling code in my head during dreams. Then I awake to an uncannily real answer.

Brian Rudolph
+1  A: 

While I cook supper or baking a cake or cookies.

Levi Campbell
A: 

At the symphony. I really like classical music but my mind always wanders and is usually stimulated by music.

Uri
A: 

While driving home after a weekend in Las Vegas.

Some years ago, I would go to Vegas for the weekend with a co-worker. We'd usually leave San Diego around 7pm and get to Vegas around midnight.

One Friday, I was working on some code and was just baffled by a bug that was crashing the software. While I hate leaving for a weekend with code in that state, we had a trip planned so I left it and we were off to Vegas.

On Sunday night, as we were driving back, it just hit me. I knew the cause of the bug. When we got back to the office where I had left my car, I put in the fix and verified that it indeed worked. Problem solved!

A: 

Middle of an empty highway, 3am, on my bike.

The mind does silly things at that time of the morning anyway, might as well put it to good use.

Pat
+1  A: 

Seconding the dream-thingie.

About 13 years ago (I think?) I was working on a 3d-engine that would render lightwave-scenes in realtime. Somehow the lighting was wrong, and for 2 weeks I couldn't figure out why. I went to sleep on a friday night, dreamt I was coding and spotted the bug. Fixed it and it worked. Then I woke up, got behind my pc, and applied the same fix for real.

Weird stuff :)

Led