in reply to coding under the influence

It is a myth that nicotine relaxes people. It doesn't, it is a stimulant. However it does temporarily relieve the stress of your nicotine addiction. With the end result that a person who feeds their nicotine addition carefully is only somewhat more stressed out (and quite a bit poorer) than the same person would be without the addiction in the first place.

I don't know what connection you are avoiding drawing between smoking and women and sex. Other than the obvious one that someone who smokes tastes bad to kiss, and so non-smokers often aren't interested in them...

Caffeine is different. People think that it is a stimulant, and it is. (Unless you have low blood sugar, in which case it puts you to sleep. That is because it stimulates you but also reduces blood sugar - and if your blood sugar is low, the second effect matters more. This is most commonly seen in small children.) However there is an issue of diminishing returns. Your body adapts to the expectation that it will be there. So every time you change your caffeine levels, there is a real effect, but then your body gets used to it and your energy level at the new consumption level goes back to approximately what it was before.

The effect is somewhat like trying to increase the heat of a house with central furnace by using a space heater. The heating system notices that the house is hotter than expected and shuts off the furnace earlier, leaving you right where you were on average. (Though the spot next to the space heater winds up hotter than it was before.)

YMMV, but for me programming happens when I am calm, rested, alert, in a quiet space and not on any drugs.