Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Are there certain activities that provide inspiration at unexpected times?

One that I've noticed is when I'm mowing the lawn or shoveling snow - living in Minnesota it seems I'm always doing one or the other. The physical activity gives my brain a chance to wander and ponder either the most pressing problem on my mind or some random thought of the day.

share|improve this question

closed as not constructive by Peter Boughton, bigown Nov 2 '10 at 22:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Yes, what you are describing is perfectly normal. It's because the logical part of the brain is getting so bored it goes to sleep and your creative part gets into full swing. There is a really cool book about this: pragprog.com/titles/ahptl/pragmatic-thinking-and-learning –  Martin Wickman Nov 1 '10 at 13:50
    
For anyone interested, there is a discussion on the closing of this question happening on Meta: meta.programmers.stackexchange.com/questions/510/… –  Peter Boughton Nov 6 '10 at 19:40
    
This question need to be edited by OP to be reopened. I have serious doubt if this question can be saved but it's possible. I will unlock if the OP wants make a better question. –  bigown Nov 6 '10 at 23:17

14 Answers 14

To take a note from a couple of old notables. Both Edison and Tessla used a nap to solve problems. I find that when I look at a problem in depth and then go on to another task, leaving that problem in the back of my mind, that the problem solves itself. For particularly thorny problems, I sleep on them.

share|improve this answer

I came up with the solution to a totally intractable database problem in a dream the other night.

I dream about programming pretty frequently. When I was intensively learning the iPhone SDK, I remember one dream featured a girl wearing a bathing suit made out of a UITableView. It was scrollable and everything.

share|improve this answer

Usually on my way home, about 5 minutes after leaving the office.

share|improve this answer

I dream a few of my ideas, sad to dream about programming but yes I admit I have. Happens sometimes after spending a few hours solving a problem and I'm not happy with the result. I tend to wake the next day and remember dreaming about coding a better solution.

My Mrs says I have even woke her at night to tell her a solution and then gone back to sleep.

Maybe I am just nuts.

share|improve this answer
    
You may want to watch the movie "Inception"... –  user1249 Nov 5 '10 at 20:46

Often when I can't sleep at night. Usually because I have a problem on my mind.

Some quite elegant and esoteric (and effective) solutions have occurred to me in the middle of the night.

share|improve this answer
    
I too often come up with solutions when I'm about to go to sleep. Which is annoying in a way, 'cause then I have to battle over whether to get that much-needed sleep, or get up and write that code in case I forget it the next morning. –  gablin Oct 31 '10 at 14:35

Either when I'm in the shower or when I'm staring at the night sky (yes I do most of my programming at night).

To me it's basically when you're doing any mundane and repetitive tasks that does not require much mental activity. That way your mind is free to wander to whatever it has been struggling on, which hopefully is your code. :) The key is that when you're showering (or doing other mundane tasks) you're not trying too hard and have no expectations, that's when the ideas start flowing in.

share|improve this answer

When I'm doing something that doesn't require me to think.

I got my best ideas when taking baths, on my riding mowner or driving my car.

Why? Maybe is as something to do with mindfullness, a state you can obtain by focusing yourself of the present.

share|improve this answer

Driving, definitely the best ideas are coming while driving.

In theory running for me would be even better, but I don't have so much time to do it anymore.

share|improve this answer
    
+1 all my best ideas come to me on my commute home. –  Walter Oct 31 '10 at 12:36

Sometimes a few weeks after release: I look at my code and wonder "what was I thinking?"

And when I leave the keyboard: lunch, call of nature, coffee break etc

share|improve this answer
    
+1 for ideas after the fact. So infuriating! –  Alan Pearce Nov 1 '10 at 10:35
    
In an interview I was given a programming test, one part of which was to sort a singly linked list. I didn't take the job. About 4 years later I realized that the perfect algorithm for sorting a linked list is merge sort, which never occurred to me at the time. I'll never know why it took so long for me to figure it out. –  Mark Ransom Nov 3 '10 at 3:40

When doing something requiring less attention of brain. Like walking in a known road, shower, sitting idle, even in the toilet.
In contrast, ideas do not come while in front of PC or television. While talking with someone, reading a book, driving etc. Because these activities requires attention.

But the attention requiring works help you to gather information. And this information helps a lot to make up an idea.

share|improve this answer
    
Some have mentioned they got ideas while driving. While I said that driving requires attention and ideas will not come at that time. Now I guess, when you will be driving in the highways it will require less attention. But in busy roads(which is very common in our country), it REQUIRES attention. –  Gulshan Oct 31 '10 at 9:59
    
+1 I put a similar answer, did not see yours. There is a concept called mindfullness that helps. –  user2567 Oct 31 '10 at 10:34
1  
Google even started a blog called Testing On The Toilet :D –  jcolebrand Nov 1 '10 at 21:36

The best programming-related ideas that ever came to my mind where when I was trying to explain my idea to someone else.

Always when you try to tell the story behind your software/idea, you have to structure it in a way that could be told and understood by someone else and that helps a lot!

When I'm telling that story to someone I find myself beginning with what I already have in my mind, and ending with a completely new and awesome idea without letting my audience know that this idea just came to my mind.

To summarize that: find yourself someone who would like to listen to your draft ideas.

share|improve this answer
1  
I find this works really well for debugging, both for myself by telling and helping others by listening. –  Mark Ransom Nov 1 '10 at 12:48
3  
I often realize the answer to my SO questions while typing them out, just the process of point-by-point explaining the problem often makes it clear what the hang-up was in the first place. –  CodexArcanum Nov 1 '10 at 14:52
1  
This is sometimes referred to as rubber ducking: c2.com/cgi/wiki?RubberDucking –  Josh Kelley Nov 1 '10 at 19:15

I've always said I do my best programming in the shower.

share|improve this answer
8  
Alas, the computer tends to short out. Electrocution is always a risk as well. –  Robert Harvey Oct 31 '10 at 6:41
2  
I'm happy this is getting votes. The shower is the best place for any kind of thinking! –  Bryan M. Oct 31 '10 at 21:44
1  
+1 Lately (lasy year) I have lots of good ideas in the shower, not sure why, used to be when driving or just about to get into bed. –  G3D Nov 1 '10 at 9:32
    
+1, Though it's not so much about specifically thinking in the shower, it's about what you treat as the top idea in your mind. paulgraham.com/top.html –  Inaimathi Nov 7 '10 at 1:35

Just after I finish implementing an idea. I've found that implementation of ideas leads to many more ideas.

When exactly? Usually when I am away from the computer, and doing something totally unrelated.

share|improve this answer

Often in the morning, when waking up, my brain is full of ideas. Keeping a notebook on the bedside table is a must. Just scribble down the ideas quickly before they vanish.

share|improve this answer
1  
sometimes I can type them faster than I can jot them, so I email myself from within gmail. Same difference, different mechanism. Depends on if the window is open. If I'm driving I call myself and leave a voicemail. –  jcolebrand Nov 1 '10 at 21:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.