8 Ways For A Programmer To Stay Sane

By  on  

Being a web programmer is hard work. Long hours, coupled with the fact that we're presented with nothing but problems, can make our job unbearable. Not to mention deadlines and unreasonable customers. Oh, and the fact that we're all casualties of the never-ending browser wars.

So why do we do what we do? We love programming. We love creating functional, virtual worlds where people can get information, post pictures, and meet people. We love taking a given set of rules and bending them to their limits. We love that we can post a collection of code that can some day be a money-making powerhouse like Facebook or Digg.

With all of the rewards that come from being a programmer, the job can still be overwhelming. Dealing with the stress that our job creates is an important skill. I've compiled a list of ways for you, as a programmer, to keep your sanity.

Know When To Step Away

Programmers, in general, are obsessive, detailed-oriented people. We don't like admitting defeat and we tend to not step away when we are frustrated. The best thing to do when you've spent a long period of time working on one problem is to step away. Clear your mind. Take a walk. Come back to your desk when you've cooled down.

Go Out For Lunch...

I used eat lunch at my computer every day -- I'd check out my favorite websites and send a few personal emails. Once more and more customers knew me, I'd get inundated with phone call after phone call during lunch and soon I didn't have ANY time during the day to myself. Don't let your lunch hour become another hour of work! Get away from your desk for lunch!

...But Eat Healthy

A healthy body is a healthy mind. It's much easier to grab a quick donut or candy bar when at the desk, but take a quick break and eat something healthy. Try a small salad, a granola bar, or good old peanut butter and jelly sandwich. Eating poorly can make a person feel weighed down or even depressed (I tell my coworkers that my self-esteem is low when I eat at McDonald's). I suggest eating a healthy sub sandwich -- it will fill you up, give you the nutrients you need, and not make you feel tired or ill.

Ignore Your Home Computer

After a frustrating day at work, stay off of your home computer -- your personal programming can wait another day. Your personal programming could become more frustrating than your work problems, and that's not what you need. Let it go for the night.

Get Another Non-Tech Hobby / Exercise

Having passions other than computer-related hobbies is ideal. Performing physical activities is even better, as it will help you stay in shape. Too often I hear other programmers speak about nothing but computer-related topics -- get out of the programming world once in a while! Find another hobby! Learn how to cook. Start playing chess. Do puzzles. Play soccer.

Spend Time With Friends

Friends are generally low maintenance and have interests other than computer-related topics. Schedule a weekend event with your friends. Get together for a barbecue, go to a movie, play video games, go to the football game, or have a night out on the town. Instant messaging your buddies doesn't count!

Take Your Vacation

When things get tough at work, don't be afraid to use your vacation -- it could save you from outright quitting when work is overbearing. You don't have to go on an exotic vacation or a cruise; hell, stay home if you want. The point of the vacation is to focus on not working.

Know If Programming Isn't Right For You

If you're losing your mind on a consistent basis and your job is affecting your family, health, or sanity, it may be time to stop. There are other jobs out there -- maybe you'd be better off with another career. Just know that programming isn't everything and you don't have to suffer because of your job.

Dealing with the stress of programming is a very important skill. How do you deal with stress at work?

Recent Features

  • By
    An Interview with Eric Meyer

    Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it? At first blush, it was the simplicity of it as compared to the table-and-spacer...

  • By
    Regular Expressions for the Rest of Us

    Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...

Incredible Demos

  • By
    Fade Images with MooTools LazyLoad

    I recently received an email from a MooTools developer asking a great question about my LazyLoad class: "I'm using your LazyLoad MooTools plugin (which is great, by the way). I have been trying to figure out how to modify it so that once an image scrolls into...

  • By
    MooTools-Like Element Creation in jQuery

    I really dislike jQuery's element creation syntax. It's basically the same as typing out HTML but within a JavaScript string...ugly! Luckily Basil Goldman has created a jQuery plugin that allows you to create elements using MooTools-like syntax. Standard jQuery Element Creation Looks exactly like writing out...


  1. Michael

    Perhaps needs some proofing. Bit of a cock-up, some of the repeated and mis-formatted stuff up there.

  2. Thank you for the heads up Michael. WordPress butchered that post on me. All is well now.

  3. dan

    how does one play cheese?

  4. @dan: Have you never been to Serbia and Montenegro? Playing cheese is their national sport. Kidding aside, meant to say chess. I wrote this after a rough night of work — that’s my excuse and I’m sticking to it!

  5. silent-observer

    “Learn how to cook. Start playing chess. Do puzzles. Play soccer.”… ok, tonight i’ll look for some tutorials on internet :P

  6. Get married and have kids :). Playing with, or even just be with, my kids after a day long coding will get me back to planet earth real quick.

    Also, don’t ever quit reading/learning about the fiel. It takes us beyond our daily problem and make them not being so big anymore.

  7. Excellent suggestions…

    +1 on exercise and a hobby that doesn’t involve a screen

    re: exercise. It is hard to worry at 8 mph on a treadmill.

    re: hobby. Get away from screens! e.g. Choose learning guitar over that wretched Guitar Hero game. Even modest songs on a _real_ instrument trumps a silly, transient game.

  8. Rui

    “Get married and have kids” eh eh eh need to get a wife first :)

  9. Ryan

    I have to go for the be crazy in the first place. Well I guess that would just be redundant we are programmers we must be crazy. :-P

  10. I totally get this and can relate to it, it seems that in our career things are very quite one day but the next you might have 6 projects on and be like HELL what am I to do.

    I found hiking was a good way of taking my mind off work but lately I have been struggling to pull myself away from my desk because simply there’s to much to be learning! :) IRN BRU and Crisps are my relief…

  11. Howard A. Feller

    Maybe the following is a little bit ahead of your time…but I hope it
    doesn’t turn you off…and no offense! I’m one of those old IBMers
    that used to work on monster type mainframe systems with COBOL.

    I, as well as my fellow programmers, went our way with these two sayings…

    1. Don’t assume… you’ll make an ASS out of U and ME.
    2. Prior Proper Planning Prevents Piss-Poor Performance, Pal. (Otherwise known as the Eight P’s of Doing Anything Right In

  12. Seet

    Hi, its a good article…

    I’m just graduated and started my job as a software engineer 2 months ago, it is stressful when you have a bad-temper supervisor and a serious-looking boss…

    Well, being scold in the company has become a part of my life. Can you/ May you write an article on how to manage EQ at the workplace, etc?

    By the ways, good luck to all programmers…happy coding^^

  13. Akash Deep

    For doing work with concentration listen music while coding, it will never prevent you from distracting from other activities happening around you. I usually follow this while coding or testing.


    Software Engineer

  14. I would also suggest to think more of the people you are designing for, about technology less.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!