in reply to coding under the influence
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.