Tell me more ×
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.

I'm talking about particular activities, for which you can draw parallels with the specific kind of reasoning needed when solving programming problems.

Counter examples are activities that would help in almost any situation, like :

  • take a shower or any other, somewhat passive activities, which are only helpful in triggering this sort of asynchronous problem solving our brain does
  • exercise, because you brain simply works better when you're fit

EDIT :
It seems this question was quite misunderstood. I wasn't asking about what you can do when stuck on a problem but rather, what kind of activities you have in you spare time that you think help you, more or less directly, solving programming problems.

share|improve this question
2  
@Mike Clark: I said Counter examples ;) – julien Nov 7 '10 at 14:56
show 6 more comments

closed as not constructive by Matthieu, Anna Lear Jan 14 '12 at 1:41

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 specific 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, see the FAQ for guidance.

16 Answers

up vote 5 down vote accepted

Chess. I've learned so much from going "What if this piece weren't there..." which leads to tactical plusses on the board. It's amazing how a game can teach you to think and play "what-if." Sometimes it's easy to solve other people's problems because you aren't burdened by the history of the task and being able to put yourself into that place with your own problems is immensely helpful.

share|improve this answer
show 1 more comment

Sleep. Eventhough I won't figure it out when I wake up, I'm just in a better frame-of-mind, have more energy and any anxiety is alleviated.

Developing good habits and the ability to take your mind away from a problem is a skill. Many people lose sleep because they are perseverating on a problem which sometimes can be productive if you're able to work through it, but can be counter-productive as well.

share|improve this answer
1  
I think this is an example of one of the OP's counter-examples. Sleep makes you more focused (for any task) but it doesn't exercise your brain in such a way to make you a better programmer. Like for example, studying math. – JD Isaacks Oct 8 '10 at 20:12
show 4 more comments

I found martial arts VERY useful. (this is a long term investment).

  • it helps you manage your mind in intense stressful situations, very useful when you face a insane bug you can't find
  • it helps you pick the best strategy, for a given problem in a given situation (you know your strength and weaknesses, and know how what to do and what to avoid
  • it helps you feel well in your body. This is very important in any intellectual work
  • people in your team tend to be less agressive, and are naturally more constructive and assertive

On the other hand, you can clear your mind by doing meditation. Personnaly, I'm unable to do that, I just can't keep my brain from thinking about something.

share|improve this answer
1  
+1 because I've been thinking about taking aikido lessons – julien Oct 8 '10 at 17:20
1  
Parce que tu es français. I know the industry because I owned a martial art gear business that I sold last year. France is very good for Karaté, Aikido and Judo. – user2567 Oct 8 '10 at 17:29
show 4 more comments

Puzzle-type games (sudoku,cross-words, logic-problems,etc.) are great for helping to exercise the problem-solving aspect of my brain.

EDIT:
Nethack
sudoku

share|improve this answer
2  
I respectfully disagree. While it is popular in computer science classes to think that programming is all about logic puzzles, real world programming seems less about problem solving and more about gluing together frameworks and components. – JohnFx Oct 8 '10 at 18:33
1  
Agree with @JohnFx. Solving puzzles is just a fraction of what real-world programming is about (and what the the brain can do). Diversely exercising all parts of the brain, not just he puzzle-solving part, would be beneficial to most programmers. – Joonas Pulakka Oct 9 '10 at 11:00
show 5 more comments

Going for a walk. Relaxes the mind, gets the blood pumping, and can let you solve things without thinking about them.

share|improve this answer
show 1 more comment

Build something from scratch. Take a pile of wood and build a birdhouse. It requires pre-planing (measure twice cut once), some architecture (floor, walls, roof) etc. Plus you get a similar I build something high.

share|improve this answer

Taking a shower. I can relax, change my focus, let my mind wander a little, and suddenly my brain makes a connection between two things I hadn't considered together before, and I know how to fix the problem. Happens more often than you might think. This may not be as specific as you're asking for, but it can be very effective.

share|improve this answer
show 2 more comments

Anything will do, as long as you're comfortable with it. Doing hobbies can help. From my experience, the following help a lot.

  • Volunteer in an organisation, because we can learn from how roles interact with each other like in OOP.
  • Draw diagrams of how the program works (in very high level).
  • Browsing other people's codes, or read source codes of open source libraries. Certain open source libraries have very good design and very inspiring.
  • Practice a music instrument.
  • Talk to some people who are nice to talk with. Sometimes they tell stories that may somehow related to programming problems and.. solutions pop out suddenly.
share|improve this answer

I've been long time Magic: The Gathering player. That helps as well as playing Strategy games or anything that challenges me to think. Excercise, when I have time, is good to.

share|improve this answer

Violent video games.

Nothing puts my mind back in frame quite like killing hoards of zombies in my quest to forget the hell that's happened earlier in the day.

Also... in line with the "Martial Arts"/meditation suggestion: exercise... or outside... in general.

Fresh air and blood flowing through your veins are very refreshing. Let the idea's percolate while actually relaxing.

Not quite as fun as killing zombies or a good Counter-Strike session... but close.

share|improve this answer

You already said exercise. I try to get out and run/jog 20-30 minutes on my lunch hour. You can't imagine how much better the afternoons go regardless of the morning.

share|improve this answer
show 1 more comment

I would say untying knots is a good analogous exercise to debugging an application.

A particularly complex knot, or compound knot is very much like a tricky bug. They both have to be methodically solved, and to reproduce the results it helps to know the steps that got you knotted in the first place.

share|improve this answer
show 1 more comment
  • Solving a maze puzzle with multiple leads
  • Building with LEGO pieces
    • Following the plan
    • Not following the plan
      • Bottom-up approach
      • Inside-out approach
  • Cake making, or bakery, cooking etc. (Disclaimer: I've never done any of this)
    • If you see someone else making something similar, you can probably make something similar, too. It may look different and taste different, though.
share|improve this answer

What about math and proofs? Doing math helped me become a programmer because I saw code as a similar thought process, albeit one that required less working memory.

share|improve this answer

Sometimes watching a TV show, movie, listening to music or reading a book can provide that spark of an idea that flourishes into an algorithm to solve a problem. Looking at something from different perspectives or finding the courage to try various solutions would be a couple of different results that I can get at times from these activities.

House would be an example of a TV show that can show various views on a problem. While the show may be fictional and the characters aren't real, I do imagine in some cases doctors get ideas from the strangest places.

share|improve this answer
show 1 more comment

When I stumble upon a problem I can't solve (yet), talking about it to a random person usually makes me solve the problem before I finished explaining it. Apparently finding words to explain a problem aligns with finding the solution better than thinking about it solo =]

share|improve this answer

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