Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What methods do you use to stay awake and alert while working?

Personally I drink coffee non stop throughout the day. But I've also heard of this thing called exercise that should help too. Does anyone else have tips and tricks to stay more awake and alert while working? Redbull? Maybe a magic pill that won't require me to sleep?

share|improve this question

closed as off topic by Walter, Giorgio, gnat, ChrisF Nov 14 '12 at 20:43

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Is it staying alert in meetings? !! :) – pramodc84 Sep 8 '10 at 7:23
I like to go outside, and walk around the parking lot. Go into the grass, and look for some ant hills. Then I watch the ants. I pay attention to how they move, communicate, their patterns, ect. Once a couple of minutes have passed, I feel recharged. Nature has all of the answers that we seek. We just need to pay attention from time to time. Drowsiness goes away, and my mind re-activates. – Pablo Dec 12 '10 at 14:08

18 Answers 18

up vote 18 down vote accepted

First, try to prevent yourself from being drowsy:

  1. Sit up straight so you breathing is not restricted.
  2. Drink plenty of water
  3. Stay away from sugar & greasy food

If I feel drowsy anyway, I will:

  1. Listen to fast music
  2. Get up & get my body moving (usually a brisk walk & I get some air)
  3. Go somewhere cold (if possible) the cold usually wakes me up for a bit

If I want to pull an all night coding session, I will:

  1. Have a caffeinated double espresso drink from Starbucks.
share|improve this answer
I'm leaning towards using the highly caffeinated drinks only for when I need to pull all night coding sessions. Don't overeat should also be on your list btw. – Brian R. Bondy Sep 4 '10 at 15:46

Caffeine is a major cause of the problem, not the solution. It might seem to work in the short-term but it makes things worse overall by interfering with your sleep.

If you don't sleep properly you will be tired and unfocused. If you try to solve that with a high caffeine intake you won't sleep properly.

Exercise, eat well, try to restrict the coffee to a couple of cups a day and don't work stupid long hours.

share|improve this answer
I've found that my need for coffee scales pretty quickly to how much I'm using. 3 cups in one day will keep me alert for that day, but within a week I'll need 3 cups to get the same effect that 1 used to give. My experience is that 1 cup in the morning is about ideal for me. – Fishtoaster Sep 3 '10 at 17:04
@Fishtoaster: I have the same problem and usually quit every 2-3 months for a couple weeks and then ramp up again. – Brian R. Bondy Sep 3 '10 at 17:10
  • coffee
  • soda
  • music
  • take breaks and walk around
  • slap self in face
  • stab thigh with ballpoint pen
  • in extreme circumstances: just get a good night's sleep
share|improve this answer

Sleep well in home. That's it

share|improve this answer

Pushups. Exercise actually increases the amount of energy you have, instead of decreasing it. Plus using a keyboard all day doesn't give you strong arms, or even make you awesome at thumb wars.

share|improve this answer

Why should you fight your own body? When I feel I'm tired, I just take a nap at my own desk. I even have a small cushion there for greater comfort. It usually takes 10-15 minutes, thus making the net effect on productivity positive.

Napping in an open space could seem ineffective due to distractions and noise. However, I usually turn distractions into my own profit. A sudden loud speech, or a sound of something falling down nearby invokes ancient animal reflexes, and makes my body think I'm in danger. So I wake up literally alert, with my heart beating fast, and my mind relaxed and ready for action. No amount of caffeine can reach the same effect.

share|improve this answer
"Why should you fight your own body" 2 reasons come to my mind as of recent, undergrad/graduate exams/projects do not wait for sleep and neither do bosses. – Chris Sep 4 '10 at 12:28

Frequent short breaks at regular intervals (get up from chair, and think of something else for a few minutes). Then a longer break after 4 short ones.

share|improve this answer

I used to drink a lot of coke. I had one night where a project (this was in school) was due at 10am the next morning. I stayed up until midnight helping other people with their projects, then slammed mine out between midnight and 5 am. I found that a can of coke could reliably buy me 20 minutes of reasonably lucid thought, so I went through a couple 12-packs. I then went home, vomited, went to class, and got an A.

share|improve this answer
+1 I can't drink coffee (too much caffeine) and coke sometimes helps me. – systempuntoout Sep 3 '10 at 18:27

Taking a break to surf the net. Studies have shown that it actually increases adrenaline production due to the large amount of stimulus it provides. Makes sense to me considering that surfing the web usually makes me feel more awake no matter how tired I was the rest of the day.

share|improve this answer
I guess the problem is if you are really tired you will only surf the net :) – Brian R. Bondy Sep 3 '10 at 16:36
The Internet is like alcohol for the 21st century. Homer Simpson:"The cause of, and solution to, all of life's problems." – Tim Goodman Sep 3 '10 at 17:42

Coffee, and caffeinated beverages in general, provide a double-action solution to the problem: they work to brighten your smile in the short term, and require you to get up and... relieve yourself periodically thereafter, thus encouraging you to walk and stretch, which is exercise and therefore helpful in relaxing tired muscles and obtaining a good night's rest.

Just the thing when you're working stupid long hours...

Note that you'll build a tolerance to caffeine after a bit - at that point, pouring the boiling-hot liquid on your lap will serve to shock you awake. TRIPLE ACTION!

share|improve this answer

Regular exercise is a plus. My company subsidises half the cost of a membership at the gym down the road, and our development team makes extensive use of it. Most of us are there at least three lunchtimes per week. Take it from me, nothing gets the blood flowing - and keeps it going - like an hour of decent exercise. It's also a great way to mitigate the effects of the sedentary lifestyle of an office job.

Also, music helps, but I find that downtempo "chillout" style music aids my concentration, whilst more energetic music like metal or DnB just distracts me.

share|improve this answer

Team programming is great way to stay awake. Other person is always annoyingly fresh. :)

If I am programming alone, I select some rock music.

share|improve this answer
Team programming doesn't work for me. I just fall asleep in front of my colleagues (while talking to them), and it only makes it even more embarrassing. – Pavel Shved Sep 4 '10 at 6:41

Last year at the Over the Air conference and hack day in London - a gathering of mobile developers - they had a Qi Gong guy come in and do half an hour of stretching and exercise, after a lot of people had been up all night programming. Half an hour of exercise out in the fresh air was a really good wake-up, even if we did all feel a bit silly with all the stuff about balls of qi energy and the like.

share|improve this answer

Having Fun - Nothing reinvigorates me mentally like having fun! Grab a couple coworkers/friends, and go toss a football around for 15 minutes, and play a video game, or whatever is fun for you. You'll feel completely recharged.

Move Around - I work from home, so when I'm feeling sluggish I put on my headphones, and do some house cleaning. It gets my blood flowing again, and gives my brain a chance to rest.

And yes, there are some magic pills that are prevalent in the IT industry (And among college students), but they're illegal without a prescription. So I'm not going to recommend them.

share|improve this answer

Nerd Energy Beverage! Besides that, I just keep a thermos full of good tea and drink it throughout the night. Doesn't make me jittery, so I'm able to focus better.

share|improve this answer

5-Hour Energy (I like the orange flavor best). Really does work, but don't make a habit of it.

share|improve this answer
Those things give me a lot of physical energy as opposed to mental energy. That makes me want to get far, far away from my computer, and perhaps go run a marathon! – mellowsoon Oct 22 '10 at 19:04

I rarely clock 12 straight. If I'm doing a 12+ hr day, I stop around 5-6 and go get dinner, take an hour to unwind, then go back at it. I've found that getting my mind clear and a little relaxed goes a lot further than all the energy drinks in the world. Caff and the worse crap in some of the energy drinks may get your body going, but won't help your attention span much.

Of course, I can put away a lot of coffee during the day if I have a lot of meetings or am compiling some of our bigger projects a lot.

share|improve this answer

I'm like you - I drink a lot of coffee, and occasionally I feel my eyes begin to droop. Then it's time to get up, walk around, drink some water (or some coffee). Maybe even play a game of pool. The main thing is to change something, and normally just getting away from the screen for 5 minutes is a big help.

If that doesn't work, it's on with the headphones. Pick a choice of music that has a bit of pace (Black Stone Cherry, for example) and crank up the volume. Just make sure they're decent headphones, as much to reduce the effect on coworkers as anything else. These are good ones, especially for the money:

share|improve this answer

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