If I need a stimulant to keep me awake, I go to sleep.
Pulling an all-nighter when I'm already in sleep debt only produces code that sucks. The next day, I'm too tired to be functional and I've got a bunch of code that needs to be thrown out and rewritten. Sleep is a better use of time.
Modafinal is a drug that really intrigues me. Many militaries have switched to it from amphetamine. It's not really stimulating, but it eliminates any tiredness you might have. The perfect drug for a mandatory all-nighter.
Oh, I have no objection to stimulants in general; I like my tea and my coffee. It's just that if I need the stimulation to stay awake and working, I'm already in false-economy territory.
Try limiting your naps to 20 minutes. This prevents you from entering the deep phases of the sleep cycle which is what causes you to be drowsy.
If you are really hardcore you can go all out and convert to the Uberman polyphasic sleep cycle. 6 20 min naps, every 4 hours apart. Once adapted you can code for 22 hours a day its awesome...
Right now I have a core sleep of about 4hrs each night. I had to come off uberman when I started working as I cant really take naps at the office except for lunch. All the more reason to quit and found a startup right?
If you're really interested you should try to find a copy of Why We Nap by R. Broughton. There's a lot of confusion and general BS on the net about Polyphaic sleep. This book takes a scientific approach. The problem is its no longer in print so you might try a university library...
As far as how it works, I love it. Being awake for so much of the day is a huge plus, but the biggest improvement is actually in how you feel. Much sharper, better concentration, mood, etc. That is if you can make it past the adjustment period and you can stay on schedule. The big downside is that its still socially a "weird" thing. People will look at you crazy when you try to explain it...
I'd consider doing it but the unknown long term health effects really scare me. I did a biphasic sleep schedule when I was working an 8-4 last year. I would sleep for 3-4 hours before work, then take a "nap" for 4-5 hours after work. About once a week I would go to bed at 5PM and accidentally sleep through the night.
Definitely coffee. I don't drink much of it so I'm not that resistant to caffeine. If you're a regular coffee drinker than those caffeinated candies or energy drinks might be a better choice.
There seems to be stereotype that high performance geeks rely on caffeine drinks to stay alive. In reality only regular sleep cycles and adequate exercises can keep you at your peak performance over the long term. Meditations can help you to control your focus and weed out distractions, so you waste less of your time when the environment doesn't fit you.
If you really need to pull a few all-nighters, consider taking something on a measurable dosage, so when you decide to rehabilitate, you can adjust your intake on a decay curve.
Chai is good. If you have free time it's fun to experiment with making your own. SpecialTeas.com has a variety of cheap black teas that work well, and the other decent site is uptontea.com, which is actually based just outside Boston. Then the rest of the ingredients you can get from the supermarket. There are a bunch of decent recipes online; I usually use the one from the rec.food.drink.tea FAQ
I buy black tea with chai spices in it already, and mix it with vanilla, honey, and milk myself. The preparation is as important to the experience as the beverage itself.
Good stuff. I'm infamous at my local coffee shops for ordering it as straight concentrate. Not often, though. Usually just to keep me awake through classes following an all-nighter.
Pulling an all-nighter when I'm already in sleep debt only produces code that sucks. The next day, I'm too tired to be functional and I've got a bunch of code that needs to be thrown out and rewritten. Sleep is a better use of time.