What helps us code, and to what extent? Is it just a placebo effect, or does the stuff we take in affects the code we put out? Higher quantity with lower quality, or is it the other way around? Is there a perfect cocktail, some magic dosage to produce the best results, or is it a myth?
As in everything in life, XKCD already identified and explained it. And lately it was amusingly portrayed in the hit motion picture “The Social Network”, which has several a&h (alcohol & hacking) scenes:
The only reason I can see for hacking under the influence would be to release oneself of the moral inhabitations of crime. Maybe its part of the Handicap principle: “I code so well that I can do it while drunk”. Those in favor of drinking while coding claim it increases creativity and relieves stress. Personally, I think the process of chatting over a glass of beer does that, and the alcohol mostly increases self confidence – justly or not.
This is no doubt the programmer’s drug of choice. In fact, it’s the world’s most widely consumed psychoactive substance. It reduces tiredness (but not the need for sleep), increases the capacity for mental and physical labor, and sends you to the bathroom more often (and we all know breaks are important). On the down side, the body quickly builds up a tolerance for it, and, in fact, a dependency on it, known as caffeine crash. The result is that caffeine no longer gives a boost, but mostly balances out the crash effects. This effect varies per person and per consumption level, but for best coding results I recommend getting a good night’s sleep and dropping caffeine intake during the weekends.
And by the way, caffeine and alcohol are a very bad mix. Caffeine dehydrates (and blocks absorption of water), making the blood alcohol levels increase, while temporarily preventing the sensation of being drunk. When the caffeine wears off, the alcohol hits much harder. So don’t drink and… drink.
While it does not promote cancer on its own, other substances in cigarettes do. It is, however, poisonous in very large dosages. As for the psychoactive effect, it is simulative in low dosage, and calming in high dosage – which is actually unique for drugs. It is also very addictive when administered with other chemicals found in tobacco (but not in its pure form).
To sum up, the main down side of nicotine is that it is usually consumed in cigarette form, meaning that it is highly addictive and cancerous. If you have an option of administering a constant, calculated low dosage of nicotine (nicotine patches? nicotine gum?), there may be a small beneficial effect to it. Small, as in, not worth the risk of cancer.
This is more a matter of personal taste, but generally music (especially one with lyrics) is harming the ability to concentrate. We use language skills to solve problems more than we think we do, and our mind has a hard time working on problems while listening to spoken words.
On the other hand there is the (in)famous “Mozart Effect” – while it does not bestow long lasting intellectual benefits, it does relax and has been shown to have limited positive effect on performance of some mental tasks. Music is mostly beneficial to alleviate the boredom of tedious tasks, but it is best to have an environment with no distractions.
Noise is usually a distraction. Some can block it out and some cannot. However, white noise is the opposite: it drowns out distracting noises in the environment and helps the mind focus. There are several white noise generators online: Simply Noise generates different types of white and white-like noise, and can even add gentle oscillations in noise level to prevent the ear from tiring. Rain is a natural white noise, and for me, it is more pleasant than generated white noise. As there is not much rain in Israel, Rainy Mood provides a 30 minute loop of rain, mixed with some gentle instrumental music. The problem with it is that after a day or two I learned the loop, and was noticing the background music too much. Another nice service is Sound Sleeping, which allows you to mix your own white noise out of sounds of rain, ocean and creek, and add in ambiance like thunder, drums or bonfire. My favorite mix is “Sound Sleeping” with a lot of the ‘rain’ sound, with ‘ocean’ for oscillations at about half the volume, and ‘thunder’ at a very low volume, just for ambiance. To that I add some pink noise from “Simply Noise”, just to set the base noise level a bit higher and drown out any intrusive sounds.
My personal recipe is coffee without sugar to treat my borderline ADD, mixed with some white noise when the mood strikes me. What’s your favorite prescription?