Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

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.

3  
Is it staying alert in meetings? !! :) – pramodc84 Sep 8 '10 at 7:23
    
I reverted the title from the edit because it wasn't grammatically correct. – Brian R. Bondy Dec 12 '10 at 13:14
5  
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
    
@Pablo: what if you live in Seattle and going outside means getting drenched 9 months out of the year? :P – Robert S Ciaccio Dec 16 '10 at 16:26
    
If you have difficulty to stay awake because you do not sleep at night: try to sleep more during the night. If you have difficulty to stay awake because you are doing overtime: stop doing overtime. If you have difficulty to stay awake because you find coding too hard: look for another job. – Giorgio Nov 13 '12 at 19:53

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
2  
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
    
Digestion by itself seems to be an energy consuming activity, but I also find that meat in particularly can really drag you down. And I do currently limit my caffeine in take to all nighters. – John MacIntyre Sep 6 '10 at 22:40
    
Too much carbohydrates can weigh you down too: if you're going to eat that packet of instant noodles, put some of your favourite protein in with it. – Frank Shearar Sep 21 '10 at 13:44
    
I find vitamins (especially vitamin water-type drinks) far better than caffeine. With caffeine, I feel tired but I can't sleep. With vitamins, I actually don't feel tired and am much more productive. But don't take a multivitamin on an empty stomach! – TMN Oct 22 '10 at 18:23

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
2  
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
2  
@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
    
Is it a caffeine thing in general? I assume steeped tea would have the same problem? – Brian R. Bondy Sep 3 '10 at 18:45
    
@Brian: tea usually has considerably less caffeine than coffee. So unless you're drinking a lot of it (or making it very, very strong) you probably won't notice the same sort of "buzz" that you're familiar with from coffee or soda. Personally, I find a cup of Earl Grey before bed actually helps me relax... – Shog9 Sep 3 '10 at 19:03
    
One or two cups of coffee a day should be fine, so long as you have them early in the day – Casebash Sep 3 '10 at 23:42
  • 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
    
slap face works well when driving and tired, I think I'll avoid the pen one though lol – Brian R. Bondy Sep 3 '10 at 16:35
    
Well, those two are for semi-extreme circumstances. Not quite as drastic as the last one. – Tim Goodman Sep 3 '10 at 17:03
    
+1 for "take breaks and walk around" I find myself doing this 2-5 times a day just even a circle around the office to get the blood flowing again is a great refresher. – Chris Sep 4 '10 at 12:27
    
HARAKIRI CODER! – Adel Feb 8 '12 at 16:50

Sleep well in home. That's it

share|improve this answer
    
you could lake some vitamins and minerals, that will lead to sleepiness, example: b12 . – Display Name Dec 12 '10 at 13:23

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
    
Although I do not do pushups in the office, I will from time to time stretch a bit which helps equally well. During my undergrad I remember many nights I would stop in the fitness center for a quick wake up. – Chris Sep 4 '10 at 12:28
    
+1 for exercise. We have a ping-pong table in our office building. Not sure about pushups though... Might get a few odd looks. – rmx Dec 12 '10 at 13:56
    
+1 for pushups. work your way up to 100. add one more per day.. – studiohack Jan 4 '11 at 21:30

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
1  
"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
    
@Chris, I'm trying to say that a short nap (20 minutes or so) is not what you can't afford. Of course, it doesn't work well when it's 30 hours until exam, and you just don't have time to sleep. But if you face tiredness on a regular basis, I can't think of anything better. – Pavel Shved Sep 4 '10 at 12:46
    
I agree, if it becomes a regular thing you tear your body (including your brain) down and this results in less then optimal effort. – Chris Sep 4 '10 at 15:35

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
    
+1 Taking breaks are so important. As human beings, we weren't meant to sit in front of computers for periods of time. – spong Sep 11 '10 at 11:23

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  
+1 I can't drink coffee (too much caffeine) and coke sometimes helps me. – systempuntoout Sep 3 '10 at 18:27
    
I don't drink coffee so a bottle of (non-diet) coke can keep me focussed for a while. I don't like to do it often though. – rmx Dec 12 '10 at 13:50
    
A's take precedence over health! – Carson Myers Dec 18 '10 at 18:04

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
1  
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
1  
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
    
Studies? Do you have a link? – Casebash Sep 3 '10 at 23:40
    
I can try digging it up, but the article is in Hebrew. Anyway, the article seemed to be concentrate on the Facebook-Twitter crowd, and it also discussed other impacts of internet use. I'm mentioning this because the idea seems to be to multitask lots of low mental effort jobs, like Facebook, YouTube, Twitter, short articles, catching up on web comics, posting short answers on programmers.stackexchange.com etc. all at the same time. Reading a long article is probably not going to help, unless of course it is really interesting. – EpsilonVector Sep 4 '10 at 5:29
    
surfing is a rabbit hole. Hours can be wasted... – studiohack Jan 4 '11 at 21:31

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
1  
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

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

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
1  
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
    
What in the world is in 5 hour energy? – Job Dec 12 '10 at 14:42
    
@Job: a combination of legal stimulants and vitamins (but no sugar) packaged as a two-ounce "shot" -- 5hourenergy.com -- in the US, they sell for anywhere from 6 for $11 (Walmart) to $3.49 apiece (convenience store singles). – tcrosley Dec 12 '10 at 18:31

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: http://www.amazon.co.uk/gp/product/B000MRP1B4/ref=oss_product

share|improve this answer
    
Of course, everyone's different, and people change their habits too. – JohnL Jun 18 at 14:24

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