views:

19499

answers:

147

I'm having a hard time taking my mind off of work projects in my personal time. It's not that I have a stressful job or tight deadlines; I love my job. I find that after spending the whole day (8-10 hours) writing code and trying to solve problems, I have an extremely hard time getting it out of my mind. I'm constantly thinking about the current project/problem/task all the time. It's keeping me from relaxing, and in the long run it just builds stress.

Personal projects help to some extent, but mostly just to distract me. I still have source code bouncing around my head 16 hours a day.

I'm still relatively new to the workforce. Have you struggled with this, perhaps as a new developer? How did you overcome it? How can I wind down after a long programming session?

Related:
Ways to prepare your mind before coding?
When to take a break?

+38  A: 

I try to leave work at work. This means doing something completely different after hours: working out, hanging out with significant others/family, TV, reading, etc. Anything not related to my day job does wonders.

I also find that working regular hours (meaning, leaving at the same time pretty much each time) also helps to keep a clear mind.

matt b
Thanks. I actually started keeping a more regular schedule recently, and it made a surprising difference.
Bryan
Misread this as `I try to live at work.` :))
mlvljr
+15  A: 

Decompression happens naturally on the drive home as long as I can go over 50. Some days on long shifts, I have to take a drive in the middle of the day for this reason; when I go back it's like going in in the morning.

Then I go home and play video games about driving fast.

tsilb
When I worked in India, it used to take hours to reach home (traffic in Bangalore is horrible). I would go home and play Burnout Revenge!
Chetan Sastry
My commute used to be the most frustrating part of my day (due to traffic), but then I started listening to audio books. It became the only part of my day when I could "curl up with a book" and soon became the thing I looked forward too everyday both getting out of bed and right before leaving work.
Dan
+51  A: 

Do something to make youself forget about it; like go out with friends for drinks, play sports, etc....

Try to have other hobbies besides programming

TStamper
+1 cooking, surfing, carpentry. http://makezine.com is great for hobbies programmers would enjoy.
bendewey
+1 doing things that don't involve intense thinking.
Lucas B
Other hobbies? You must be joking..pure hackers don't have other hobbies.
gorsky
+1 I jump around roof tops fighting to rid the streets of evil-doers in my city. 8-)
Eddie
Photography, Cycling.
Auxiliary
+39  A: 

A number of things could help - exercise, meditation, art, music.

Some disciplines like yoga, and martial arts are particularly good at developing clarity of mind.

Bayard Randel
yoga is nice but is easily a pain/boring/dangerous/awful with the wrong instructor (either too strict or too western will both fail)... keeping the body flexible will help prevent injuries while doing all that bicycling, mountain climbing and geocaching you do to supply teh brain with oxygen aso ^^
Oskar Duveborn
meditation (yoga, Qi Gong etc.) takes practice - and gets easier as you practice. It really works!
Daren Thomas
+73  A: 

In the initial years, yes, all things are new and they keep bouncing. Once we are used to working with some years of experience, our mind automatically starts looking for something different, and sometimes we get married as a result :-) ...

Alphaneo
+1 I think distance definitely comes with age/experience
matt b
+1 All of the above :)
Arnold Spence
Funny but not actually helpful. Decompressing and returning to the world after 8-20hrs of coding is a real issue.
dbkk
so the advice is "get old, fast"
dr. evil
dbkk: 20 hours of coding? You need a new job.
jmucchiello
@dbkk - seriously, get a life (not in derogatory sense of the expression). A wife, a gf, hell, even a cat or a hobby. When your brain is either busy with something else, or in a completely relaxed state (every try petting a cat or a wife for 10 minutes? :) ), you won't have an issue with code stuck in your head.
DVK
+9  A: 

Find other things you are passionate about. For me it's my kids, politics, church.

jlembke
+64  A: 

I try and bike home - cycling, especially long, hard rides, with climbs, will do wonders for your well-being. When on a bike, redlining your abilities, its really hard to think about anything else. Plus a little vigilance goes a long way when dealing with cars and other things on the road.

Neil Kodner
I try to take it easy while riding to work - mainly I'm just trying to wake up. On my way home I go as hard as I can to work out the frustrations of the day.
geofftnz
I recently moved to an apartment 9 miles away from my work. It's the perfect distance for a hard ride even though it's pretty flat. Not only does this help me throughout the week, but it keeps me in shape for the weekend when I can go mountain biking and do 3000-4000 feet of climbing and still feel okay afterwards. I used to absolutely kill myself on weekends climbing from 7000-10000 feet on a 10-mile trail.
dasil003
Cycling is great exercise, but if I ride in traffic I tend to get a bit hyper and wound-up. Riding in traffic is like some weird kind of heightened awareness state where you have to focus on 1000 things at once, it's all happening really really fast and it's crazy dangerous. It's fun, but not exactly relaxing.
David HAust
If dodging traffic by cycling is a problem, how about running - either along pavements/sidewalks, or find a park. Work out a route with minimal traffic interference. You can think about work, but after a while your mind will clear as you start focusing your willpower (when you start tiring), maintaining your pace, breathing evenly, etc.
KarstenF
I also ride to and from work. Great to keep you in shape, and great to relieve stress. The heightened awareness thing in traffic works out well for me, because it makes you concentrate on something other that work. It forces you to clear your mind.
Kibbee
"If you can dodge traffic, you can dodge a ball." -- But seriously, off topic, what about biking on a roadway is more difficult than driving a car? Other than the fact that I want to hit you because you can't do the speed limit... But you know I never would, because then I'll have to bike to work... but I digress.
tsilb
I use the gym - same effect.
Jarrod Dixon
I bike too and from work too - in nyc traffic. And while sometimes I get a bit wound up about idiots blocking the bikelane (which is illegal in nyc) I find that it's really great way to get my mind off work - although sometimes I come up with solutions to my programing problems while biking too:)
quoo
Biking to and from work is an excellent way to put "bookends" on the day. On my ride into the office I get geared up for work. On the way home I am able to wind down from the stresses of the day.
ahsteele
Cycling for me too. Nothing gets rid of stress faster than riding regardless of the goal. Whether I am pushing the limits or just out for a quiet ride, cycling just works. It allows you to take your mind off of coding so that your subconcious can work on the problems. Effective as going to the bathroom!
Krisc
tsilb, what's more difficult is if you hit me, I'll be seriously injured or dead, as opposed to looking at a bill for some scratched paint. But, yes, we digress...
slowdog
+167  A: 

Program some more. Only the weak can't program 24 hours straight.

:)

Anyway, I like to go outside and play with my pets, something physical and less mental.

GMan
People's ability to 1) not take a joke and 2) not leave a comment when downvoting baffles me.
GMan
Hey, I doubt this sounds like a joke, especially to younger programmers in the audience. 24h straight is not common, but I'm sure we all have done it a few times... and ended a bit messed up.
dbkk
I like pets. !!!
Martin K.
+1 QFT... umm wait, that's not a Q... UVFT?
tsilb
+1 for "getting outside"
hometoast
I'm with you. I have pets, I spend time with them after work. I code between 8 and 12 hours on most days, yet I never have any problems unwinding, unless there's something I'm disastrously stuck on - which is where this website comes in handy (sometimes at least).
karim79
Jon Skeet programs 27 hours a day.
Pwninstein
Haha! I wrote almost exactly the same answer as this, but before I posted it, I figured I'd take a look through to make sure no one else already wrote it, but it looks like you beat me to it! (Mine did have Jon Skeet in it though :)
Yoely
@GMan The Greeks believed that you could not have a healthy mind with out a healthy body. No comment on down vote = Fear.
JustSmith
But don't tell your boss, they will expect you to code 24 hours a day AT WORK!
stefanB
Come on, just one more vote for a gold badge!
Earlz
@Earlz: Yay! I totally forgot about this answer.
GMan
@Pwninstein: That reminds me of Chuck Norris jokes.
Leo Jweda
@JustSmith: tell that to someone like Stephen Hawking...
TM
+24  A: 

A young developer myself, I know where you're at. Believe it or not starting your own project at home to work on 1 or 2 hours a day after work seems to give a different perspective on things. Do a simple project 3-9 months (estimate). Only work on it for a limited time, especially on weekends, to make sure you go out and have fun. Chances are you probably have some old abandoned hobby you can get back in to. Things from our childhood make us especially happy (google Seligman + psychology).

One of the most important problems we're facing is that all of a sudden we're faced with a much more sedentary life style. Try to go for a run or do something to stay physically fit, it helps the mind, and our egos.

David
after 8 hours programming, 5 days a week, the last thing I can face is more coding.
Antony Carthy
+1 for anti-sedentary answer.
JoePasq
+7  A: 

When I was young, I had a pretty close group of friends and we were all similar techs, we would purge all our thoughts by ranting at each other for 30 minutes, after that we had to stop talking tech (allowance made for films, gadgets etc).

These days its easier, I stop work, go upstairs and put in some decent family time, cook the dinner, and have a glass of shiraz.

MrTelly
+20  A: 

Ah Bryan

What a fantastic problem to have!, What luxury!. Love your job, your mind filled with interesting code problems. I dont think you realise how lucky you are.

As you travel along in your IT career, more and more your problems will become less interesting, you mind filled with administritave procedures, budgetary constraints, people issues, legal hassles.

Now is a golden time for you, just relax and enjoy the moment. :)

Michael

Michael Dausmann
This is true, unless you become an "expert" instead of a "manager."
Yar
If you jump onto business.. yes this makes sense. How can you be an 'expert' without caring about the 'business' value of your code and the domain in which the technology you're an expert at is adopted?
lb
+19  A: 

After I'm done working, I tend to cook (a similar but different exercise) which is generally relaxing. If I've had a rough day, playing some xbox seems to help, especially an FPS, or just listening to music or watching TV.

However, if I need a technical "hit" I might pop onto Stack Overflow and answer some questions - engages my mind technically without wandering into work related problem solving, which tends to keep me awake at night.

RobS
+247  A: 

2 parts gin, 3 parts tonic water, 5 ice cubes, squeeze of lime... and a willing spouse.

BikeMrown
3 parts jack, 1 part jack, 1 part jack... and someone who knows where to pick you up
Jason
Bryan will get this once's he's worked for 20 years! (For me it's 2 parts Jim Beam 3 parts coke and 4 ice cubes...)
Stuart Helwig
i prefer 1 part fresh lime juice, 2 parts wodka, 1 part curacao blue and 4 parts sprite.. and a lot of ice cubes
pduersteler
... 1 part beer?
Zeus
Johnny Walker Red on ice and a session of Left 4 Dead
Mike Robinson
"Alcohol is a direct brain and liver toxin. It will increase your chance of contracting cancer, contribute to osteoporosis, ulcers, and hypertension. There's also a 5-10% chance that you will become hopelessly addicted to this drug which could easily lead to losing your job and destroy your marriage." And many mooore... i.e. not a good solution to this problem. Why so many upvotes?
Svish
@Svish As always, everything in moderation; even moderation itself. A beer on the porch, a glass of wine with dinner, a gin and tonic on the deck; nothing wrong with that. It's when you kill a six pack every night, or slam back half a fifth of Jack when you get home, that you have problems.
Adam Jaskiewicz
Those are only problems if you're not in college anymore :) In college, that's a light drinker.
rmeador
Oh and for me it's one raw sugar cube, several dashes bitters, a small splash of soda water, muddle, 2.5oz rye whiskey, and three ice cubes.
Adam Jaskiewicz
Nothing wrong with a sophisticated gin and tonic, served in a proper pint glass. Let the puritans worry for me, and I'll enjoy myself instead.
JeeBee
@Adam Moderation are for things that are good for you (like carrots. Too many will make you turn orange/yellow, and probably kill you even). But when it comes to substances that are directly harmful to you, total abstinence is the way to go.
Svish
@Svish I'll take my abstinence in moderation.
Adam Jaskiewicz
@Adam Abstinence is abstinence =) Anyways, what you guys do is up to you of course, I just find it a bit annoying that alcohol is so often reported as a solution to many problems. When it actually is the cause of even more. And sometimes even the cause of what someone say it is good for. But moving way of topic now, so I'll just leave it at that =)
Svish
Alcohol: the cause of, and solution to, all of life's problems.
Adam Jaskiewicz
-1, alcohol --> bad
hasen j
2 drinks a day keeps the heart attacks away. So says the mayo clinic: http://www.mayoclinic.com/health/alcohol/sc00024
Waylon Flinn
Dos Equis ftw! Nothing better.
corymathews
Would you consider changing "wife" to "spouse?" I mean, I know that 99% of our users are probably males or trying to be...
Yar
+1 helping me with today's unwinding. So funny.
Eric Wendelin
"Alcohol is the cause of, and solution to, all of life's problems." -- Homer Simpson
Roee Adler
Hey, bars allow us the fun the social parts of our jobs generally lack.
Dean J
It's sad that in the absence of a willing spouse we so often turn to the machine that created the need for stress relief in the first place.
Jamie Ide
Like the notorious John Lee Hooker once said, I'd go with one scotch, one bourbon, one beer.
born to hula
I think some of the alcohol references are an attempt at humor, which is also a way to clear your mind after hard work.
Abboq
@svish even water, if consumed in high enough quantity, will kill you
Pestilence
@Svish: "Alcohol is a direct brain and liver toxin. It will increase your chance of contracting cancer, contribute to osteoporosis, ulcers, and hypertension."Maybe, but not relieving your work-induced tension is even worse for you. ;) And with so many studies also showing benefits to moderate alcohol intake, I consider drinking to be an even game, health-wise.
machinatus
@Pestilence: That goes for anything does not make alcohol any less bad for you.
Svish
@machinatus: Why use something that is bad for you to relieve that tension when there are so many good and healthy ways of doing it? And what are these benefits of alcohol intake? I have heard claims of wine being good for you, but it's not wine, it is the grape. In other words grape juice is healthy. Alcohol is still not. I consider drinking alcohol to be a pretty silly thing to do when there are so many good and healthy alcohol free alternatives.
Svish
@Svish - It's ironic that your avatar shows a picture of you using fire clubs. I used to juggle both fire clubs and fire-proof hacky sacks (wearing gloves of course) but stopped doing it regularly because of the carcinogenic smoke that is emitted. I do however still enjoy a drink. Pick your poison :)
Si
@Si: That's why I don't do it regularly either and I also do it outside where there is plenty of ventilation :)
Svish
So you're doing something bad for you in moderation?
Toon Van Acker
@Svish: “Alcohol is a direct brain and liver toxin.” — You mean a *delicious* brain and liver toxin. @Toon: “So you're doing something bad for you in moderation?” Good and bad for you are not boolean values. There’s a range of factors to balance with every health decision — alcohol, for example, can damage your liver (bad), and help you relax (good). The right choice depends on each person’s individual circumstances, so if you don’t know them better than they know themselves, you might as well leave them to it.
Paul D. Waite
These days I'm into a good Belgian beer (http://en.wikipedia.org/wiki/Beer_in_Belgium).
waffleman
Alcohol is actually a brain food - in moderation :-) Has been know as such since ancient Greek times .... I'll have Cognac - double of course :-)))
ZXX
A: 

When I have been working on some problem, even when I am being quiet, I will sometimes be thinking about work, and this is healthy for me, as my subconscious will often find a solution I haven't considered.

This used to happen often when I would go to the movies, and I find that it still happens when mowing or driving home from work.

James Black
+2  A: 

I don't think this problem is only related to work. Thoughts of anything you have done will always keep coming to your mind. You should not get worried about this that you can't keep your work off your mind. Simply enjoy whatever you do afterwork. If you enjoying what you doing then work related thoughts will not bother you. But if its giving you trouble then probably you need to find something else after work which you will enjoy. Once I go home I get time to play with my little daughter and all the stress just disappears. Gym and swimming also helps me and I love watching sports wo when I am busy in this my work is off the radar.

Bhushan
A: 

take a break :)

Josh
+348  A: 

Funny you should bring this up, because I have the same problem, and I have actually devised a technique that works really well for me. I use the last 5 minutes of my day to write myself a debrief note for the next day. This will do three important things;

  1. It takes your mind off the complexities as the debriefing will be a short form of all the things you've worried about, and helps clear the mind of all the what-if things.

  2. If your mind has a long down-settling time, the debrief note is the perfect place to use for a central of "things I forgot about" or should note somewhere. The debrief note becomes a knowledge central for whatever you did that day.

  3. It focuses your mind on the real issues. One thing is to clear the mind, another is to let it keep going, but more focused. So even if your conscious mind is letting go, it's probably a good idea to let your unconscious mind keep churning at the problems, and a good way to help your mind do this is to be slightly futuristic in your notes (thoughts on direction, for example).

Here's a real example from my note yesterday (with some notes in brackets) ;

  • Struggled with the new simplified data model for Topic Maps integration as recursive key/value pairs don't always explain complex relationships, but think that the added 'scope' column handles most if not all of my use cases. I feel I've reached a good place where some heavy coding can take place. Enough thinking, more doing. (Helps me get a feel for what I was doing, what I struggled with especially, and that it's about my feelings. Feelings is actually important in trying to make the brain settle.)

  • Implemented the dreaded global stack which seems to be working fine. (Focus your fears and worries where it belongs. 'Dreaded' prepares me for uglies in the future)

  • Talked with ZZZ about banners for the front page, and can probably do this through the Index Front Controller the easiest. (Put down some thoughts you've had on upcoming work. Once down on 'paper', out of mind)

And so on. I never have more than 3 to 5 notes on any day. If you feel there's more issues, try to classify them into 3 to 5 notes anyway. Anything more than that will freak your mind, and you're back to square one. :)

An added bonus of this is that this is, in fact, a developer's log, which many, many would recommend. After a while these notes will be so good they fit into release notes as well. Practice, practice, practice.

Good luck, and tell us what you came up with (a debrief note, if you will :).

AlexanderJohannesen
Thanks so much for sharing this! I'll have to try this one! I'm much obliged...
onnodb
I write To Do notes for myself at the end of the day, it has the same effect: it stop worrying that I might forget valuable thoughts. As an added bonus it helps me get everything back into my head the next day (especially on Mondays/after a day off).
Jacco
this approach is kind of the core of GTD, good answer.
dr. evil
+1 i do the same, by summarizing at the end of the day I find that I don't have to think about the problem that much during my evening with my family.
Anders K.
+1 because I tried it and it works! debriefing now whenever I feel I can't relax!
tharkun
I've been trying this since reading your answer and love it... really helps me clear my head before going home and has the added benefit of helping me write my weekly status reports. Thanks for a great idea.
Neil Williams
That sounds very good, gonna try it
winden
It is very interesting for me to see that so many people do same as I. However, I use excel for the log.
Kwang Mark Eleven
Great suggestion, I'll try this out right away. Thanks!
macke
I do the same. It creates a log of activity and you can check what you tried/were working on. Very useful.
Francesco
Started with Outlook reminders, moved on to end of day Email; eventually evolved into an ongoing text file with the current status, TODOs, and obstacles of all ongoing projects.
tsilb
If the main thing I'll be doing the next day is coding, I often put a compile error in the code. Usually I type out a comment on what I need to do, then remove the // and save. The next day when I come in, I open the project and build: *Crash!* I go investigate and discover my note from yesterday, and then it's easy to start where I left off.
Kyralessa
@Kyralessa: If you start your comment with the word ToDo (case insensitive), you can open the Tasks list in visual studio and see your entry there.
borisCallens
In a sense this a "blog" post to just yourself. Nice technique.
David Robbins
Funny thing! I sometimes think of potential problems / solutions at home and I can't usually relax until I have written them down (very worry to forget them). I'll definitely try that, seems it could really work for me.
Matthieu M.
if your note is no more than 140 characters, just tweet it.
Anwar Chandra
@Kyralessa: I do almost the same thing. I write such notes in the form of a failing unit test such as: context "Where I left off" { should "<do what I intend to implement tomorrow>" { flunk } }.The first time I hit save the next morning, autotest comes up red and tells me what to do next. This accomplishes the same goal without actually breaking the build.
Logan Koester
+111  A: 

I found work was a bit of a contrast to academia, in that when you're studying there's no 9-5 — your hours are when you want them to be. In work, I've tried to keep a crisp boundary between the 9-5 day job and my personal life.

Some things that help are:

  • Stick to regular working hours: I try to be strict with myself on how many hours I spend at work. This helps to keep a healthy work-life balance and prevent work taking over my mind.
  • Cycling to and from work: I ride daily and, in addition to keeping me in shape, it helps to take my mind off work on the commute home. (There's no time to think algorithms when you're pre-occupied trying to predict which motorist is going to try to kill you next.)
  • Watching a little TV: After the ride home, a 30 minute sitcom can help me lighten up and get my mind wandering. Or if I'm feeling more serious, I'll watch a few TED Talks and realise there are much bigger problems in the world than my current work challenge :-)
Daniel Fortunov
TED talks are awesome!
Marcus Lindblom
"There's no time to think algorithms when you're pre-occupied trying to predict which motorist is going to try to kill you next." Hehe, been there, done that (as a cyclist I mean). You should probably patent this quote.
eljenso
+1 for bicycling! And indeed a good quote :-)
stiank81
Where I live traffic isn't that dangerous, but on my bike I tend to let my mind wander of to near-zero activity :P Music definitely helps
borisCallens
its videos like the ones on that site that really make me wish real-time captioning was more feasable for the deaf.
Jason
+1 for the cycline as well - but really depends where you work (for city geeks cycling home with a headache from coding is nearly about suicide)...
Gnark
+1 for cycling! (Work in the city so no time to think about work problems)
LnDCobra
So you're that jackass who's always slowing traffic down.
samoz
samoz: In London, the cars slow cyclists down, not the other way around.
Daniel Fortunov
+23  A: 

Play Team Fortress 2 or go to Starbucks to read and study.

Ronnie
Or quakelive or urban terror or l4d or ...
mark
¿More computer?
borjab
Dude. Jon Skeet plays Team Fortress 2 at Starbucks WHILE studying. So can you.
Dan Esparza
Who's Jon Skeet? Never seen him in TF2.
Kirill V. Lyadvinsky
Or Left-4-Dead. Personally I prefer Half-Life 2, especially the zombie levels, like RavenHolm.
Warren P
A: 

Train to play with your local comptetive ultimate frisbee club team.

Jason
+7  A: 

Here's the question... If you love coding so much, then why do you want to force yourself to get take your mind off the thing you like? I mean, if you truly love doing something and can do it 24x7, then why not? Let it be!

I have a feeling that either someone tries to force you off coding (parents, girlfriend, etc), or makes you feel uncomfortable when you're at computer; or you yourself are thinking that this is not good to code too much. In the latter case, you gotta recognize that each person is different and if you like to do something that "conventional" folk doesn't do, it's not a problem. People only look similar, each of us has vastly different interests and it's not constructive when you're trying to squeeze yourself into a "normal" person's envelope. The reason I'm putting "normal" and "conventional" in quotes, is that such thing doesn't even exist :)

If it's family or friends, or significant other who's trying to not let you do what you like, be firm. It's your life, you are the one who decides what to do and how to live.

galets
Thanks, but I think you may have misinterpreted the question. It's not that I think there's something wrong with thinking about programming, it's that I have a hard time giving my mind a break, which leads to stress.
Bryan
everybody needs to relax and have a life sometimes. When I'm walled up behind my computer, I'm significantly less happy than I am when I go out with friends regularly. As much as I love programming, I love life more.
Carson Myers
I love sex but wouldn't want to be doing it 24/7. It starts to chafe after the 3rd hour.
eviljack
+35  A: 

No need to do anything special.

The human internal garbage collector runs automatically when you slow down and stop focusing ,since it's based on a genetic algorithm evolved overt thousands if not millions of years, it is very efficient, you will barely even slow down when it actually runs :)

If anything is leftover, sleep will take care of it by rebooting your short term memory subsystem.

Jean
+1 For making me laugh
LnDCobra
+63  A: 

make out with a girl

Nils
As opposed to... the dog? Apparently.
windfinder
@windfinder: ROFL
Bobby Cannon
Ha! where are we going to get a girl?
Nick Whaley
is this also advice for the girls among us?
spender
@Nick guess u have to go out
Nils
Go dancing. http://thelindyhop.com Women dig geeks these days.
Dave Jarvis
@spender - seeing how watching girl/girl makeout session is a major fantasy of most lonely male geeks, I think that advice was for the girls too... altough for adviser's own benefit more than girls' :)
DVK
@Nick Whaley a coder is not necessarily a coffein driven monkey with no attention to reality
penguinpower
@Nick Whaley: http://www.mailorderbrides.com
graham.reeds
@Nick: `mine.other = new girlfriend(/*...*/);`. Fill in the `/*...*/` depending on your preferences. Try to not to lose the object. And for some it's `mine.others.push_back( girlfriend(/*...*/) );`
sbi
+5  A: 

For me, many things work, and I do try to leave work at work. But 2 top methods if I need to specifically evict work stuff:

  • Music (listening to, playing)
  • Exercising

Both of them are generally relaxing, and help if I feel tired (although if superb exhausted, best way is to sleep of course).

StaxMan
+1 same list for me :)
Ruben Steins
+1  A: 

go to sleep, watch a movie, watch any sitcom comedy, take a walk in the park, play with your kids.. if you are a foodie, eat something you really love

Vikram
A: 

Go for a run (or any strenuous excercise).

I agree with the reasons @Neil Kodner pointed out.

When you really push yourself with physical exercise, absolutely everything else seems to drain out of your mind.

The only thing you can think about is sucking in enough oxygen to not pass out (and the pain) ; )

It's oddly refreshing and energising.

I find excercise as beneficial for the mind as much as the body.

David HAust
A: 

Even though I feel like going straight home to eat, shower, and pick up where I left off, I do one long 5mile run a week and work out at the gym 5 days a week. I never feel like doing it, but feel better afterwards. When I finally do sit back down in front of a computer I have more energy and can look at challenges with a fresh point of view.

philip
A: 

Clearing the mind ...

I don't think it's bad to chew on things. It always takes 2-5 days for the best solution to a problem to occur to me. Spinning on problems is annoying, so ...

Exercise is essential, and a joy, if you have a sedentary intellectual job. Search around that information network for research on the mind and the importance of physical exercise. You need physical exercise to keep your brain healthy and cool off the stress. A little sweat can't be promoted loudly enough -- most people aren't getting enough exercise despite hearing this hundreds of time. How about putting it this way: You will produce better software faster and with more pleasure if you take off an hour early and exercise.

I bike to work. I work in a city and find it is the fastest commute as well as found time. With an small investmest in good gear (gloves, rain-gear, decent bike, etc) it is pleasant in any condition. My 30-45 minute bike commute totally clears the code-head - or gives me time to turn problems over in my head in a relaxed way.

Precipitous
+27  A: 

Martial arts help me clear my mind.

Hideo
Yes, I too play Street Fighter.
MGOwen
+1 for the martial arts, as to perform effectively you need to become absorbed in the moment, and reaching this state generally clears your head of the extraneous conversations. Exercises with Bokken, Jo, Chuto and Tanto really helped me get my head straight.
David Robbins
A: 

Gaming, photography and sports ... after all the stress i just need to get out from time to time.

Sem Dendoncker
+95  A: 
grivei
That's about 12 for me... not a good way to prepare for the morning. :)
Darren Clark
ohh ... the morning, that should be another question :)
grivei
There's a place where those beers might just help your coding! http://stackoverflow.com/questions/84556/whats-your-favorite-programmer-cartoon/84815#84815
Jarrod Dixon
It doesn't always work.. and what is produced after a few beers ain't pretty, either
RobS
+1 just for the awesome picture :)
Morningcoffee
I have always maintained I can code perfectly well while extremely drunk. That comes with an important caveat, someone else has to type.
SoapBox
You can't drink all day if you don't start in the morning
Dinah
These don't make me stop programming, they just make my code look more interesting the next day :)
Michał Piaskowski
There's a t-shirt around showing three increasingly pixelated pints of beer, each with a caption of an increasingly late point in the evening.
Jivlain
+2  A: 

Watchin Scrubs and Family Guy!

...and Poker, Alcohol and Women

kevchadders
+ 1 for Scrubs!
Felipe Fiali
+1  A: 

Personally...

I prefer long(ish) commute. I used to drive 45 minutes to work, now I take a ferry back and forth. I could take the train that takes 20 minutes, but I'd rather sit in a boat for 45 minutes and unwind.

I think the key point in all the responses is that you need some sort of break between work and home. If it's 30 minutes in a car, that works. 30 minutes on a boat, that works. Get frantically home then do something (like exercise) for a bit, that works.

There does need to be a break of some sort I think.

Darren Clark
Personally, I don't like the long commute and even if it does clear my mind of programming, it usually does so at the expensive of being annoyed about the commute.
Rob
Well, it's not annoying when it's on a boat. ;)
Darren Clark
A: 

A well known problem and I don't think this question is misplaced here. If you can not switch off after work, you won't sleep that good, which affects the work next day!

At my initial time I hardly could sleep when I had to solve a tricky problem during work, especially if I already have a solution in mind, but couldn't try it out yet. Than I keep the solution in mind and search for improvements, because I don't know yet if it really works.

But since then I calmed down a bit. Mostly I work a bit longer until I tried it out, but if it does not work I need some distraction. Most effective are making sport outdoor, or just use the cross-trainer with a running TV, cooking, baking and the rest makes my fiancée :)

Enyra
+35  A: 

I've had similar experiences from time to time, depending on the nature of the projects I've been working on. A few things I've found help:

  • Many of your habits were likely formed while a student. Remind yourself that you're at a computer 8 hours a day now, so some of them can go, e.g.:

    When you get home, don't check your emails. Or use the damn computer. No one will have sent anything that important in the time it took you to get home. You probably had your personal email open at work all day.

    Learn the art of the of the 7-10 minute nap. After a hard day, just make sure to spend ~7-20 minutes in a decompression routine you figure out over time.

    I used to live in a flat with a band practice room in it that someone would be using when I got in. That's the opposite of what you want.

  • If you have trouble leaving before 5:30 or so, take a cue from the business analysts (or various non-developers) and just leave on time. It's too easy to get caught up in the 'just fix a few more problems' state, particularly when there's a group of devs in that state and no one wants to be seen to be the first to leave. Sure, do your work, but set yourself some rules about when it stops.

    Typically it'll take until most people's next 2-week holiday (usually the new year period) to re-resolve to do this.

  • Good old fashioned beer. Not a lot of it, just one or two. Make sure to have a few with your co-workers, particularly non-devs. If it isn't happening, instigate a few work beers once a month on Wednesday or so, or around milestones.

    I'm not saying this as a silly ode to drunken chatter, it's just that it's been an incredibly valuable tool for getting out of the incredibly focused mindset of the problems you're coding/debugging tend to leave you in. Sure, you're likely doing great work, but there's a bigger picture, and this is a time-tested, simple way to remember this.

    (Usual caveats apply on this one)

  • What everyone's getting at with the sports / hobby / girlfriend thing is simply to find stuff to get you out of your head. You spend all day inside the thing, and your body's happy to leave you there - and that's the source of your woes.

    Find something that exerts / exhausts you, is creative / abstract, or otherwise deals with the world around you. Which is why I'd suggest avoiding reading - at least for the purpose of your goal you've stated.

    Of course, the girlfriend part will occasionally leave you with bigger logic gaps to comprehend than the code you're worried about, but...

Anyway, enough from me.

Hope this helps.

Overflew
+2  A: 

Swimming...

Dhana
+2  A: 

Well, relaxing is hard when you have excess of responsibilities...I do envy those that can live well with that...

In my case, I try to do sports (running, swimming) and then relax by cooking and listening to music (and, of course, enjoying lots of TV shows)

Luis Abreu
+1  A: 

Go kitesurfing. There's nothing better than an awesome sunset kite-session after work.

kiteloop
A: 

Walk from work to home, go to a gym, spend time with family, or devote a bit of time to your hobby (of course if you have one except programming :P)

SeasonedCoder
A: 

Running, outside specifically... you cannot afford to run outside and not be aware of your surroundings (especially in the city).

I've yet been able to find a cure for dreaming about a challenging problem though....

Pat
A: 

Only two things can really get you mind of the code:

  1. Working out
  2. Liquor

Practice both regularly, and you will be GRAND!

Ma99uS
Preferably in that order, unless hillarious things might occur ;)
kigurai
+5  A: 

I've once had a boss who was very tolerant to us, the IT guys. A former sysadmin himself, he even made a rule for us. No work during the last hour of the day, only emergencies. We were spending that hour shooting each other in Quake 1. Our kind boss wasn't even disturbed by our wild screams, because he was doing it with us :) I don't claim this is a panacea for everybody, but it worked for us. We were always leaving the office very fresh, with a clear mind and in a good mood. A dose of adrenaline makes wonders, you know...

Anonymous
+108  A: 

Sex... See, you stopped thinking about work already

Xetius
lol, ..........
hasen j
I concur (indeed)
Evan Plaice
A: 

I also struggle with this problem almost every day. Here are some of my recommendations how to win this fight :)

1) Do some sports, e.g. climbing is extraordinary good, because when you climb, you have to be fully concentrated on the path and don't have time/opportunity to think of the job. I also cycle to/from work, go to the mountains, swimm, make long distance running etc.

2) Find some friends who are not IT freaks. Talk with them about "normal" problems like broken car, children etc

3) Find a girlfriend/get married (except your girlfriend/wife is the same kind of freak as you are, that wouldn't help)

4) Have children/buy a pet

5) Buy a non-IT magazine, read a book, go to the movies/theater.

6) Go for a drink with couple of friend - I strongly recommend it at least twice in a month.

Good luck :)

Thomasek
A: 

Find interesting stuff that's not computer related. For me, that is music, working out, gardening, etc.

Things that are very unvirtual, I guess.

Paul Nathan
+4  A: 

Meditation has really helped me in all areas of personal and professional life. It's all about focusing on something very cyclic and routine, such as the air touching the tips of your nostrils when breathing in and out. You practice "mindfulness", which is really another way of saying "distancing yourself from your anger, fear, frustration, happiness, sadness, ecstacy, and etc". You don't have to try to achieve all the spiritual aspects of meditation that are sought in Buddhism (such as ego loss); it can be simply a way to relax. Try this book out: Mindfulness in Plain English

temp2290
A: 

Spinning poi, staff :) It's not quite martial arts but it's good to just let your muscles talk to each other and let your mind drift for a while.

fractos
A: 

go out into the world like sit down on the grass and just do nothing and look around it does wonder's. i personally love going to the beach especially ones that are empty so you can only hear yourself thinking the wind and the water.

Annerajb
smoking the grass also helps
shogun
A: 

A blend of physical and mental activity is generally perfect.

You cannot think about work because you are required to think about something else. The physical activity will also help you relax and cool.

Suggestion : motorbike riding!

Edouard A.
+1  A: 

All of the good answers have a pretty common theme: diversify!

For me it's play guitar - I make it up as I play. That helps because it uses a different part of my brain to programmed. I don't know what your hobbies are, but try doing something completely opposite to your day-to-day job. A diverse mental portfolio has the same strength as a diverse stock portfolio, and leaves your options open should you ever become sick of being a programmer.

Mike Robinson
+20  A: 

Not directly to get your mind completely off of it, but for me it has helped a lot to have pretty steady working hours and a stationary computer at work. I.e. not a laptop that you bring with you home that lay somewhere screaming for attention:

Use me! You know you want to! You could get so much done if you just pick me up and work a little! You know that thing you are thinking about right now, come try see if it works!!

Svish
Nice compartmentalization. For that matter, give up the CrackBerry or devices that keep you tethered to work too.
David Robbins
A: 

Take a class of some kind. I am 23 in my senior year and working full time. On the days I don't have class I find myself engaging the problem you described. Attending class really takes my mind somewhere else. I'll come into work the next day without having given a second thought to what I was working on for 15 hours.

Josiah Ruddell
+14  A: 

Join a local rock climbing gym. It will be the most fun and best way to stay in shape. You have to focus on what you are doing. It's easy to let your mind think only about the next hold and the next movement up the wall.

Of course that brings a new problem: How to wind down at night after climbing...

it's easy to wind-down after rock climbing - you're too exhausted not to :)
warren
A: 

I punch people in the face. Seriously that is the absolute best way to clear my mind. If anyone wants to join me visit http://www.fighthouse.com/muaythai.html

Bob
I like to weight train and I've been wanting to add some "fighting" style training into my routine. I have a heavy bag but I'm unsure how to start... Any ideas?
Bobby Cannon
I think the best thing you can do is find a Boxing or Muay Thai gym. You will learn a lot more by having someone who knows how to punch watch you and give you feedback. Don't go to a gym which offers "Kick boxing" classes, but a real boxing/Muay thai gym.
Bob
A: 

Applied tai chi chu'an . As earlier comments indicated: physical exercise, having to keep your mind on where you're moving various body parts, dealing with people punching or kicking at you, or simply keeping your balance -- they all have a tendency to push out other concerns.

Dan Fleet
+2  A: 

try yoga. It will relax you and refresh your mind so that it is ready for writing more code.

Amit
+10  A: 

Weight training / Body building... well more weight training then body building. I'm not willing to put forth the effort to do true body building.

I started 3 years ago not being able to bench press 100 pounds. Today I weigh 168 and I can bench press 225 on a good day and 205 any day. I used bench press as an example because it's the most common measure. I feel incredible and it helps to clear my mind.

I would like to know if there are other developer that like to do weight training.

Bobby Cannon
Haven't done it in a long time, but when I did, it felt great. Any form of exercise is good for the body and helps clear the mind.
BacMan
A: 

Find a hobby. For me researching my family roots (genealogy) worked excellent because it could be done in front of a PC ! www.Geni.com Doing exercise is another way of get your head off the job. Hope you get the "cure" ;)

pabben
A: 

Fishing generally does it for me.

Peter Mourfield
A: 
  • Get a religion
  • Look for a purpose in your life
dr. evil
-1 for suggesting religion as a solution
e.James
Try to find whether or not there is another place other than the earth with living objects.
xport
why the downvotes? who's happier, religious people or non religious people?
i am a girl
Apparently they are afraid of religion and doesn't believe it can help them to find inner peach, shame.
dr. evil
@e.james you are probably from montreal?
i am a girl
@jenny: No, but I am from Canada. Why do you ask?
e.James
@Everyone: I did not intend for that comment to be an insult. I comment my downvotes because I prefer to receive comments when my answers are downvoted. I voted the way I felt, and left the comment to explain why. I hope that it has not been misinterpreted.
e.James
@i am a girl : who's happier, the simpleton or the sage? And which of those would you rather be? But this question is not about happiness, so we can keep our inner peaches to ourselves.
ANeves
+50  A: 
  • Swing dancing. Exercise and socializing and good music all at the same time. I do this twice a week, and it's the best thing I've found to keep me sane. (There are also women there. True story.)

  • Have a beer. Something fairly light (not a lite beer; just not stout---a nice amber ale or something) and cold. Just sit there and sip the beer, and don't think about anything. Sit on your front step, watch the clouds drift by, and sip your beer. And use a freakin' glass, you heathen.

  • Cook a tasty dinner, and have a few friends over to enjoy it with you. This should involve wine and conversation (about stuff like movies, books, music, your last vacation, etc., NOT work).

  • Read a book. Not Code Complete, you geek; read a damn novel. Preferably something you wouldn't normally read (i.e. don't re-read Lord of the Rings for the seventh time).

  • Take a vacation. Don't go to Florida and sit on the beach with your laptop, though; go hiking in the woods for a few days where your cell phone doesn't even work.

  • Listen to music.

  • Play music.

Adam Jaskiewicz
Better yet don't go to Florida at all. Go somewhere where you will not need air conditioning to survive five minutes. (Yeah, I just can't wait to move north)
MiseryIndex
I wasn't suggesting going to Florida. I was decrying the typical "go to Florida" default vacation where people end up just sitting around doing whatever they would normally do on a weekend, except that they're doing so in Florida.
Adam Jaskiewicz
+1 to dancing! It really helps clear the mind as it both physical and mental - especially when you are learning.
BacMan
I like the idea of reading a book and have done it in the past. When you have an hour and a half of train each way, you can churn out books pretty fast. I got really into the Soviet-German portion of WWII last year because of commuting to work.
Krisc
+2  A: 

I have two children (3 and 1) and when I leave work I don't have a chance to think about work. Not sure it is relaxing though.

Keith Bloom
A: 

I put a lot of energy into an answer for a similiar question... It starts off with a little blurb about productivity, but I would give most of the same advice: Stackoverflow: How Do You Vent Stress As a Programmer?

Brian MacKay
+68  A: 

Ballmer Peak

Chris S
I think this has come to be the story of my side programming projects. Its amazing the work I can get done.
corymathews
The Ballmer Peak occurs at a BAC of .1337
RodeoClown
@RodeoClown - Haha, I hadn't noticed that before. Thanks for pointing that out.
JasCav
http://xkcd.com/323/ ... you know, for credit.
Cory Larson
I wanted to try this... NVM, I don't wanna talk about it :(
Leo Jweda
wow... a xkcd cartoon in a high ranking subjective post. didn't see that coming.
Evan Plaice
A: 

I drink a few glasses of white, dry wine.

Andrei Rinea
A: 

Problem 1: you say your job is not stressful yet later say your condition builds stress. If your job is not inherently stressful but you get stressed from its content, that's a red flag.

Problem 2: you don't like the intrusion of problem solving in your thought process after work hours. This is part of the fun, but it can only be so unless you find a way to operate your mind as a multi-threaded machine - that is, if you want a life and stay in this business. I too am constantly thinking about writing code and solving problems. I do it at my kids games, at the dinner table, watching TV, etc. It does not get in the way. I can recall being at a play and getting an idea that eventually grew to something big.

I'd say that if you stop fighting it you may learn to enjoy it and integrate it into the other parts of your life so it aint so stressful.

yetanotherdave
A: 

There are two things that keep me from having this issue, and it IS a major issue for a lot of programmers.

  • EXERCISE Your focus change 100% during a workout. You have focus on yourself and not your work. Plus it will do you good :)
  • Scheduale what your task for tomorrow are. Although you can remember it without doing so it allow you to completely change your focus.

I know both things are mentioned but they are mentioned along with many other things. These two things are the key to this question for me.

The real napster
+2  A: 

The mind, just like any other part of the body, can be trained to program or to relax. There are lots and lots of ways to do this. Here are some:

  • Educate yourself to stop thinking about the job the minute you go home. This is really really important
  • Don't work long hours unless it is really necessary. Also educate yourself on this. The stress and tiredness will eventually get you if you work too hard
  • Go do something which you really like
    • Like sports (which is easy to get going)
    • Martial arts are great, but it takes time
  • Meditation is also great, but it also takes time
  • Start doing psychoterapy with a professional
  • Find a nice girl
  • Anything cultural really (reading, dancing, music, cinema, theatre, etc). Maybe you'll discover a new passion

Just bear in mind, it is easier to learn a new language than to change the habits of the mind. Make sure you persevere, don't expect some things to change overnight.

Miguel Ping
A: 

Plan some goals for your day at work and try to focus on completing them by the end of the day. Try to get organized so that you have a to-do list written down somewhere so that tasks don't accumulate in your head and make you think about them all the time.

When you get home, start doing something immediately like cooking, gardening etc. Anything not work-related.

Gruff
+1  A: 

Try Binaural beats to relax, sometimes it mays work ! :p

Nicolas Dorier
A: 

I have to concur with a lot of responses here, that you need to get up and move around: playing a sport, riding a bike, etc. Myself, I just take a good half-hour walk around my neighborhood and it helps a lot.

I used to fire up Half-Life or Team Fortress to decompress (I still play them, but for other reasons), but just getting up and moving gets blood flowing to your brain and gets you thinking about other things. It does for me, at any rate.

EvanK
A: 

One thing you need the longer you have a sedentary job - Exercise. You must exercise. Your stress is not related specfically to programming. My guess is that you'd be this way no matter what kind of job you had. Again, the first step, exercise.

Also, you must prioritize things. If after a while you continue to have massive stress, you need to decide if your life is worth the stress/project/job you have. I'm not saying quit. I'm saying your job shouldn't be so important that it kills you. There are other people that program that have learned to say no to certain things in their job. Perhaps you are deriving too much satisfaction from your job, which in the end, will fail you.

But I do believe when the newness wears off you will somewhat calm down. If you continue to not calm down you need to think about stress management, and again, this is not a programming only question. Many people feel this way about their jobs.

Although I don't have one and would starve if I did, there is something (good) to be said for manual labor jobs.

johnny
+2  A: 

My good friend Mary Jane. ;)

A: 

8-10 hours of coding? Lucky you. Most programmers are lucky to get 4-5 hours of programming done. The rest is spent in meetings, reading other peoples code, and various administrative tasks.

But getting picking up ones kids and making dinner for them tends to flush my head of any work-related thoughts.

JesperE
A: 

Snacks, Singing, Sleep, Sports, S*x ;)

fwoncn
+3  A: 

A serious problem not only for full-time coders. I myself have bought an excavator which I use digging to clear my mind during weekends. Strangest hobby ever, works very well... ;)

(http://boonzaaijer.wordpress.com -- in Dutch)

In other words: find a totally un-computer-related hobby.

André Boonzaaijer
+1 Thanks, that made me laugh. =)
Bryan
A: 

Do some physical exercise. I know it sounds too heavy for some people, and there's a lot of enemies of exercising, but there is no better way to clear your mind than having to do some muscular effort. In my case some swimming is the right choice. Just try it.

backslash17
A: 

Halo 3 Multiplayer.

Uri
A: 

Start collecting frags, play Counter Strike 1.6 Multiplayer

Salman A
A: 

I think that is a good question, this would happen to most developers around the globe. if you willing to do, this will help you and your organization to work out quality product and less developer stress http://scrummethodology.com/

khousuylong
+2  A: 
  • Swimming
  • jogging
  • simply walking
  • roller skating
  • healthy food
  • good sleep
  • no alcohol
  • talk to people
  • do something else (not on the PC )

You need oxygen, a lot of oxygen. Healthy food and good sleep. Forget about a regular alcohol dose - it eats from your brain's capacity much more than you would expect ... Talk to people ... be social ... Do not go too deep into the computer program world ... Even it is the most fascinating one ... You might get lost ...

YordanGeorgiev
+1  A: 

I've had this discussion with my co-workers and honestly I don't have this problem. When I leave work, I also leave anything behind that is bothering me. It is a rare day when I even think about what I did that day at work after I leave.

Jeremy Cron
+2  A: 
  1. Beer
  2. Sex (I'm married to a very understanding spouse)
  3. Play with kids
  4. Yard work
  5. Walk
  6. Read
  7. Reality Television
Chris Brandsma
+4  A: 

running just running ......

A: 

There are good things you can do. such as open the cs 1.6 and take a AK47 to kill somebody online. Especially I like to join a server which allow team kill and I might headshoot a teammate who is aimming at enemy with AWP. That really make me happy and relaxed. After that I got energy for another coding day.

Millionbonus
A: 

Music, or art or some other right brain activity.

paulmorriss
A: 

Gaming usually does wonders for me and helps keep my mind off whatever problem I'm currently trying to solve. I usually play some mindless FPS where I don't have to concentrate too much. It doesn't always work though, sometimes I just have to finish a problem before doing something else.

martinp
+1  A: 

About 20 minutes of F1 on my PS3 usually does the trick for me. I think it's because the game requires my full attention/concentration, which clears everything else out of my head.

Find an activity that you can start without warming up to it, stop whenever you want, requires your full attention, and has no lulls or lags in activity to break your concentration.

The same thing tends to work for starting work again, too.

Jarrod
+1  A: 

I generally try to take a walk, and then play a run of Team Fortress 2 with friends. Generally, I find that trying to converse with the players as well as not get fragged tends to clear out my mind pretty fast.

Sukasa
+1  A: 

Walk home. Yeah, walk. Use your feet. This might be not the best solution in USA, but in most European cities, this is quite acceptable solution, since the distaince between work and home usually is less than 10 kilometers. Walking distance of about 3 kilometers / 2 miles will be enough to clear your mind (the rest of the road home can be done with public transit).

smok1
+6  A: 

Buy a house.

You'll instantly have dozens of things to take care of that don't involve any programming at all.

Michael McCarty
+1  A: 

Run for 30 minutes and lift weights; I recommend Slipknot for the drive home.

Martin Streicher
+5  A: 
rally25rs
+1  A: 

These might seem like two utterly different solutions, but let me recommend video games (particularly twitch-based first person shooters and sports games--you don't want to have to think much) and yoga.

TheFoot
+1  A: 

I like to do something physical yet still involved in the creation or destruction of something. Even during school, I worked a summer/winter/spring break construction job which involved electric, plumbing, and demolition (GLEE), etc. Get yourself a hammer and some lumber.

Also, sometimes a good way to decompress is to program for fun/yourself. Coding for work and coding for fun are two completely different mindsets. But you have to be careful not to start working on code from work and making it fun... strange things start to happen.

Mike
+14  A: 

There are 3 things that really help me with this problem:

  1. Excercise, excercise, excercise (For me, it's jogging in the woods...)
  2. Make a to-do list for yourself for tomorrow, or debrief yourself as AlexanderJohannesen wrote (Excellent post btw)
  3. Don't engage your thoughts

With the last one, what I mean is this: when something about programming pops into your head, simply note to yourself what you're thinking about right now; don't try to force it out of your head. Don't start to solve any problems, but make a note that you're thinking about a problem. Be a spectator to your thoughts and not a participant. Strange, but it works! ;-)

trolle3000
+1  A: 

The best is a bicycle ride home.

djschwartz
+1  A: 

I moved to Hawaii last year and work remotely. Yesterday, for example, I walked with my wife down to the end of our street, jumped into the Pacific, and swam until sunset.

THEN I had the previously recommended beer.

ChrisW
+5  A: 

Since the answers are already quite good, I'll just add a quick list of what helps me:

  1. Hot shower or bath
  2. Mindless video games
  3. Taking a walk or drive to just let my mind work through things
  4. Work out/exercise
  5. Talk to a friend or coworker
  6. Meditate (depends how worked up my mind is)
  7. Sex (when I'm so lucky)
  8. Drink (in moderation of course)

It all depends on the situation and personal preference, sadly. I wouldn't mind if there was a cure-all for an overloaded mind :-)

Gabriel Hurley
+1  A: 

Initially i used to get nightmares of the code...

but now i am playing new games, watching movies and listening to music on my iPod Touch.

Biranchi
A: 

Play ice hockey, basketball, or go to the gym. A really intense workout really helps take my mind to a different place. If it's a sport, it's a lot of fun, too. And you'll feel like superman/superwoman after. Group sports give you a chance to talk to people, too, and joke around, which is rewarding in so many ways.

But don't go home first. Bring your stuff to work with you. The second you get home, it will be 100 times harder to motivate yourself to leave. Go straight from work to the gym/rink/court/whatever!

skypecakes
+1  A: 

As many other posters said, get some exercise! Even if it is just swimming laps (as many of us Arizonans do year round) or walking to the store rather than driving. Physical exertion is a great way to relieve mental exertion.

Additionally, let someone else do the thinking! Read a (preferably fiction) book, listen to some tunes, play a video game, do something to, "let the mind breathe," as my parents used to tell me.

Ultimately, do something enjoyable and not involving a computer or intense problem solving.

Matthew Jones
+1  A: 

Pretty much anything which requires a bare minimum of concentration will do: Bicycling (not in a city!), wood chopping, sleeping.

Equally important is to remember which activities will not work: Fast-paced games, more programming, web browsing, reading.

l0b0
"Equally important is to remember which activities will not work: Fast-paced games, more programming, web browsing, reading." Yes one should emphasize this!However right now I'm surfing around, because I have a hangover and cannot concentrate on difficult things (math homework or coding)..
Nils
A: 

Why not play mafiawars in facebook?

Christy John
+2  A: 

Do SPORTS you geeks!

Polo
A: 

Sitting in my car for 2 hours to get home :(

Coentje
That made me hate work in general, honestly. I don't understand how people do that for long periods of time.
Dean J
+2  A: 

Riding a bike home (commuting) focuses your mind on staying alive and not getting hit by a car.

I have found nothing better than that.

Tim
I live in Holland. 99% of my way to work is on dedicated bike paths. Keeps me from worrying about cars.
bromfiets
I envy you. We should have such paths here...
Tim
+1  A: 

Unfortunately for me, if I'm feeling down after work, I just drink until I can't feel feelings any more =[

Shahin
+1  A: 

I find anything that gets me away from the idiot box does the job, especially anything outside. I usually hit one of the many spots in my area that is off the beaten trail and just go exploring nature wise. Or go for a drive, with no destination, and see where the road takes me. Not only are these quite relaxing, but you find some neat stuff off the beaten trail (like old cars, abandoned theaters, marooned ships, etc...)

canadiancreed
+1  A: 

have you tried a FPS on the xbox or ps3? definitely helps clear the mind of daily "what-if's"

drupii
+1  A: 

Talk to your best friend.Thats what I do.

Ravi
+1  A: 

I love cooking.And being an Indian its enough to keep you busy and refresh your mind while cooking the Indian food.

Ravi
+1  A: 

Do something physical, which requires focus, but no analytical thinking. Two examples that work for me: cooking, and boxing (Muay Thai, to be precise...). When an issue is on my mind, it's hard for me to let go, even when I want to. Chopping onions, or doing a routine, are a great way to fool your brain and force it to focus on something else, using a different set of neurons. Find the one that works for you!

Mathias
+2  A: 

Find the loooooongest way to get home from the office, and ride your motorbike thow it ;)

j.a.estevan
+1  A: 

I run. It doesn't matter how excited, angry, or [insert other emotional state] I am, running for an hour or more has a way of clearing my mind and let's me focus on what really matters.

And I don't just run at a leisurely pace, I run with intent. I run hard enough for the given amount of time that I collapse on the couch. After maybe 10 minutes of running hard, my brain seems to limit what I am able to concentrate on: my breathing, my footsteps, and the most important thing on my mind currently. I have enough focus to enjoy every deep breath, every footstep, and the clarity to think through my most important thought.

s1n
+1  A: 

Go do some strenuous exercise. Then wolf down a pound of pasta an drink some water. Then read some non-sci-fi until you go to sleep.

just_wes
+1  A: 

Some years ago, I had similar problems. My doctor then suggested me to write down the ideas/thoughts that popped up during my free time. I have tried to follow this and it really helped me: I was then able to "forget" since my mind knew, that the idea was not lost, but saved until when I needed it.

Practically I do it by writing short emails to my office address.

Marcel
+1  A: 

Take the dog for a walk. This of course assumes that you have a dog! Dog's live in the moment, so watching them and walking with them can help you do the same.

jbloomer
+2  A: 

Chill music, definitely :)

Junky
+1  A: 

I ride the two hours home on my motorcycle...

Certainly helps to clear the head of anything programming-related when you get a good clean, clear run down the highways!

Pat
2 hour commute? I think you may have some deeper issues to work out.
ChaosPandion
+1  A: 

Sit down and have your cat lie on your lap. Stroke the beast gently, and listen to the soothing purr. Any cat can show you the true meaning of quietness.

Thomas Pornin
+1  A: 

I agree with taking notes at the end of the day.

And one of the things that helps me clear my mind the most, is driving my car back home. I love it, specially in the summer with the right music playing in the background.

It's my instant stress reliever.

rogeriopvl
+2  A: 

Have a baby, who will then ensure that most of your spare time is profitably occupied so that work will be last thing on your mind.

This can backfire though if you use him/her as a sounding board when trying to explain difficult debugging issues (I am blessed with a son who will grin inanely whilst I try to explain a multithreading bug that's been bothering me).

the_mandrill
+1  A: 

cycling at the limits :)

cherouvim
+1  A: 

Drive home with the car stereo on very loud.

Jeremy Simon
+1  A: 

I love pipe smoking. Everything from visiting the local tobacconist, to having a favorite pipe, to the ritual of prepping a bowl. It takes patience and skill and it fosters contemplative relaxation...

But you'll have to have a saint for a spouse!

davecoulter
+1  A: 
  • Drawing or painting something really helps
  • Sometimes, a small glass of wine keeps the brain working, depends on the mood, use with caution!
Johann Philipp Strathausen
+1  A: 

With more coding, naturally.

When I finish my day job, I go home and work on "my" project. I look forward to it all day and go into it refreshed, with all thought of "work coding" gone.

But, as I go bed, I am already looking forward to "work coding" next day, because being a away from it has generally given me some new insight.

Ymmv

Mawg
+2  A: 

Bike to work, or take up a multi-sport. Believe me, once you start training for a Triathlon you'll have a hard time thinking about much else outside work. But hey, that would be another thing to get obsessed about.

wonea
+1  A: 

Gardening (I have 500m2 to maintain), playing Wii (current favourite: NFS Nitro), Stackoverflowing (yes), walking with dogs (I have two and live nearby a "dog beach").

BalusC
+2  A: 

Learn an instrument...piano, for example. In a few years, when you're quite familiar with the instrument you've learned, start improvising. When you're improvising you enter in some state of mind where your rational/blocking controls are shut down. Well, any improvising activity would suffice, actually. :)

Jorge
A: 

Watch anime to stimulate my imagination as well as to relax. I also read books.

jean27
+9  A: 

Sex. And cuddle time after.

maxwellb
Sex? Link please.
wilhelmtell
+2  A: 

Catch up with all your favorite TV shows. I'm talking marathons. Nothing like 5 episodes of Futurama in a row to clear your mind.

Watched all the shows you like? Get more!

Also, I'm not a TiVo owner myself, but that should help out if you do have one. :)

GeReV
+1 Nothing quite like bingeing on Hulu after a long day of coding :D
Austin Hyde
+2  A: 

I've tried both light and heavy exercise, and don't seem to get the same thing others do out of it for stress relief in the short run. In the long run, being in better shape better enables your body to deal with stress, so that's been a win.

When I was in my 20's, I was a hypersocial heavy drinker; I went from work to the bar, and probably talked to 100+ people I already knew in any given week.

Social exercise - a weekly volleyball session, or even a bowling league - is a pretty darn healthy combination.

These days, I do custom woodworking, with both traditional and power tools. Having something physical and vocational to do helps me focus quite a bit, lowers my stress level quite a bit, and is something fun that produces permanent, solid things.

Dean J
I can't remember where but somewhere I heard that once you start enjoying exercise it's because your body is releasing endorphins (which make you happy). Once I started enjoying running, I could never stop.
Lucas McCoy
Two hours of heavy endurance work - (135+ bpm heartrate) - and it's still not fun for me. I may be wired differently than most, but my body seems to think that "runners high" is a falsehood.
Dean J
+2  A: 

Play Counter strike or any other online game :)

Chankey Pathak
A: 

Go skateboarding.

Something about hurling yourself down stairs, getting "nutted" by rails, and landing sweet tricks clears my mind all to well.

sdolan
+1  A: 

This is indeed just another (all be it specific) version of the 'get a hobby other than programming' answer, but here goes.

I recently started taking RC helicopter lessons. Flying such a beast is very demanding on your concentration. So much so, that it totally blocks anything else that might have been on your mind otherwise, so I find it works very well indeed. My simulator has become my friend in this regard. ;-)

peSHIr
+1  A: 

Odd as it may sound I'm a Lego builder. Every so often I'll get a large Lego set and build parts of it after work. I find that it is 'mindless' thinking, you just make it look like it looks in the picture on the box. Just 30 to 40 minutes of that really relaxes me for some reason.

Jason
+2  A: 

I took up gardening - simple manual work frees my mind. In the winter, odd as it may seem: more programming, but then on private projects

LocalJoost
+2  A: 

Cup of coffee and a game that requires your full attention (usually a multiplayer action game or a well hard retro console game).

I also have a rule that I don't do anything computer-related for at least an hour before bedtime, otherwise THAT will require clearing your mind :)

Henrik Erlandsson
+1 for not doing anything computer related before bedtime. I've made that crummy mistake before. Takes forever to get the problem out of your head.
JasCav
+1  A: 

It's REALLY hard to do that when you get home and have your Mom, Dad, Sister/Brother OR Wife/Girlfriend ask you a million computer-related questions.

But you should really get yourself one of the following:

  • A girl (preferably one who's not into computer science)
  • A beer with friends
  • Friends to hang out
  • A console, or a computer game
Felipe Fiali
Er... hope that the girl doesn't ask you computer related questions ;-)
Nelson Reis
@Nelson hahaha! So true! I edited the answer!
Felipe Fiali
+1  A: 

My other hobbies help distract me from thinking about what needs to be done at work.

Crocheting is particularly useful because it's almost a mindless task. Just keep track of the rows. :) Although, I should be careful with the word "mindless" because it does require focus or else you'd be bound to mess up.

I don't know how you feel about crocheting, but I would suggest trying out some new hobby (not related to computers). :)

Another new hobby that retro gamers might like: geeky 8 bit perler bead work

townsean
+1  A: 

If you have a girlfrend then do something together, like going outside, have fun, and forget about some hours of your job. This makes me relax, even in the hard days.

Kszili
What is this "outside" you speak of?
GlenCrawford
When I say going outside I mean some outdoor activity like walking together, sitting on a bench and talking about NON coding topics, etc...
Kszili
+1  A: 

If I'm just leaving the office and I need a "quick hit", I go straight to the movies (saw Inception a few days ago... twice). At home, watching mixed-martial arts usually get me pumped up and in a completely different state of mind, even more so than watching T.V.

Rafael Belliard
+1  A: 

I watch The Simpsons; very funny, specially Homer

maroxe
A: 

1- Songs of Nusrat Fatah Ali Khan

2- Painting

Arman