Best ways to fight fatigue when coding?

by bpg_92on 3/31/2016, 4:37 AMwith 19 comments

Just wondering if you have tips, somethings I just want to give up coding, I don't know, it is just one of those moments, really stressed out.

by sudojudoon 3/31/2016, 8:24 AM

First, don't set deadlines that make things difficult. Give yourself time to do the job properly. If the client is too demanding, they're going to be a problem in other aspects of the job as well. Gaining respect first comes from respecting yourself.

Second, get plenty of quality sleep, that means no caffeine/alcohol for 6-8 hours before bed, and allowing yourself at least 8 hours of uninterrupted sleep.

Third, when working, get up and walk around once an hour, for at least five minutes. Have a healthy snack, do some push-ups, walk around the block, anything but sit.

Fourth, exercise! Do something that makes you sweat for at least 30 minutes a day. This one is a must, no excuses.

Fifth, stretch. This can be done during your five minute breaks. If you do nothing else in this list, do wrist flexor and extensor stretches (look them up). Otherwise, your coding career can get cut short (speaking from personal experience). Stretching takes 2-3 minutes and can make a world of difference; do them every time you're feeling stale. It's not possible to stretch too often.

Next, eat right. Keep your diet light, skip the soda and chips; eat fruits, nuts and veggies, drink water. You're already sitting on your ass all day, don't make it worse by fueling yourself with garbage.

Finally, have some hobbies that don't require a screen. Go hiking or biking. Play a sport. Learn an instrument. Bird watch. Build a tree-house. Catalog all of the different bugs in your yard. Whatever, just get away from screens.

All of this is obvious and a no-brainer, right? Well, look at the people who have been in a field for 20-30 years, the ones who stick to the above are easy to spot; they're the fit, happy, healthy people. The others are easy to spot too, because they look like hell. Get into these habits before you need to, you'll be saving your future-self a lot of trouble.

Hope that helps. Time for my workout...

by shanehobanon 3/31/2016, 8:11 AM

In my opinion, you only have about 4 hours maximum of quality coding in you a day - I want to stress the quality part of that.

You can code 12 hours a day, but compare the code in your first 4 hours to your last 4 and see what I mean.

Just stop coding. Do other stuff.

I find that I can extend that quality window by spreading it out more. Don't do 4 hours in a block. Do an hour, or 1.5 hours and break for 30mins. Clear the head again. Then go back, you can do this more - leading to > 4 hours of quality code

by joelgon 3/31/2016, 8:32 AM

I've been experimenting with working away from an Internet connection, and it's been working really well for most things. It has two great features:

- it forces me to focus only on code when I'm coding, since 9gag/Reddit/Facebook aren't available, and

- it forces me to get up and walk around and do physical things when I'm taking a break from coding

I find I am less fatigued and about as efficient, even if it means building a queue of Googleable bugs/questions that I return to when I'm back on the internet.

by altotreeson 4/1/2016, 3:39 PM

The one thing to avoid is too much caffeine, or any other stimulant. First thing in the morning, I have found that they make me feel like the most brilliant, innovative writer and developer ever. So I have some more, and a bit more, and a touch more...

Later on in the day, I cannot even understand some of my earlier thoughts, I get shaky and generally burnt out. Watch out for too much of a good thing.

I have also found that sleep, a brisk walk in the afternoons, and exercise after work help tremendously. Taking care of yourself will improve your work life greatly. Sure, you can grow more proficient and versatile sometimes by locking yourself in a room in front of a screen coding, but do it too much and the impact will be more negative than positive. YMMV.

by tmalyon 3/31/2016, 3:23 PM

Take a break, read something not about coding. Go for a long walk or hike. Clear your head.

by ruraljuroron 3/31/2016, 11:29 PM

Barbara Oakley has some great material on focused vs diffuse thinking. If you are struggling and frustrated with something it is probably the right time to walk away and give it a break. You can solve problems in your sleep.

by rolfebon 3/31/2016, 4:50 AM

Back when I used to work a second job in the evenings, I used to get home around 4-5pm in the afternoon and have a nap. No more than 20 mins (set the alarm clock!). Made a huge difference.

by hdenon 3/31/2016, 7:35 AM

Try coding on a hammock.

Hammock Driven Development https://www.youtube.com/watch?v=f84n5oFoZBc

by bbcbasicon 3/31/2016, 9:44 PM

For me

1. I saw a specialist doctor because I was fatigued coding or not coding. Turned out I needed some treatment.

2. In addition I quit my job in a stressful environment where I was pressured to get complicated work done quickly, with little or no help, working with people who were either arrogant or just too busy themselves.

Now I work 38 hrs a week and I am happy. I have energy to learn in my spare time, and I am just learning stuff I find interesting not to 'enhance my career'. Also have a family and sleepless nights due to having young children, but that is manageable if the work environment is good.

by angersockon 3/31/2016, 4:39 AM

If you feel like taking a break, just take a break. :)

When you feel better, come back to it--you aren't any worse for doing so!