Neither alcohol (at least in a big part of the world)
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
I put it to you that comparing computer programming with the practise of medicine is an inappropriate comparison at best.
Have you ever seen a doctor that saved the current state of the patient, in case they did something foolish. Only to reload the previously saved state? Nah, me either. "Alt-F, Save-As 'patientPreAortaIncisionInCaseIDoSomethingDumb.human' " Try saving then restoring that.
Never seen a doctor with Ctrl-Z either. Seen dozens that wished they did.
I'd consider it a reasonable comparison if the survey asked if the code had been written _and_ released while in an intoxicated state, but it doesn't.
Why? The current ratio is one in four of working while on some kind of drug.
Look around in your company. Are there more under drugs in your environment?
For a permanent setup, this ratio would surprise me for professionals.
I made a couple of unspoken assumptions for my no:
1) Prescription drugs that do not impair oneself do not count (for example Prilosec a prescription drug for reflux doesn't count).
2) Same thing with over the counter medication. Keep in mind that medications like Benodryl do impair you so they count as a yes. I don't tend to get sick and when I do I don't take anything that would impair me. I have to drive 1.5 hours to work each way so I can't take anything that would impair me.
3) I do not count caffeine (yes that one is debatable; I am just listing my assumption).
4) Under the influence in the context of alcohol requires you to be impaired. So for most adults a single beer or glass of wine will not put you under the influence.
Now if the question included being impaired by lack of sleep then it would have been a definite yes.
I guess its fair to ask, what is drunk! I am sure there aren't that many who have been completely stoned and very drunk, but I am sure there must be many who have a a couple of beers, or a small toke!!. As you state, it depends on how much each individual is affected by different levels, and at what point it impairs you significantly.
Not only was it meant for production, but it's still running there ... 10 years later. That was done three companies ago, but as with some other comments, it is so cryptic that nobody knows how to change it. If it's not broken, why fix it?
Well, under the influence of alcohol and drugs, it sometimes became good for production. If you were very amazing when some problems were not ended because of unknown errors for several days, clear you brain with a little alcohol and think more carefully what is the problem.
Then sometimes, solution appeared.
The general concept of getting some distance from the problem and then - after letting go - get back to it with a clear mind is a very good solution, but creating this distance by using alcohol bears the risk of addiction. It should not be the usual way you "solve" your problems. Instead you could try to literally run away from them by running some miles or cook a good meal or do kung fu or meditaion or read a book, etc...
Just be careful.
There's no way I could write code whilst pissed or wasted. Couldn't possibly concentrate.
However, when I was somewhat younger (sounds like a four yorkshire men moment) and a mainframe engineer I did rock up to work stoned a couple of times. Worst was after a Cure concert ('bout 1981 or '82). My mate's older cousin was the Cure's manager so we ended up smoking some big fat numbers backstage afterwards and then I had to stagger off and do the nightshift. FAAAAARRRK. Never again.
If your neighbours don't listen to The Ramones, turn it up real loud so they can.
“We didn't have a positive song until we wrote 'Now I Wanna Sniff Some Glue!'” ― Dee Dee Ramone
"The Democrats want my guns and the Republicans want my porno mags and I ain't giving up either" - Joey Ramone
Back in the old days, when the HP 9825 was still in production, the three drink lunch was fairly common in the defense industry. Not only was our nation's strategic defense infrastructure designed and built by the low bidders; they were drunk half the time, too!
I'd day it'd be just the same as coding when you're sick or tired - you'd find it hard to concentrate, so it'd take much longer to do it properly and probably result in code that you will re-write later when you are back to normal.