I have to be honest, I know a lot of people who claim that they can write really good code if they've been drinking.
I just absolutely do not understand how that is even possible. If I have ONE beer, it throws off my ability to write good code, or hold all of the concepts in my head.
One of the weekly coworking meetups I go to always ends at a brewery (there is a brewery next door to the hackerspace where it is held), and while it is certainly a lot of fun being there brainstorming things, I don't understand how anybody gets actual code written after drinking.
I've found I'm markedly better at two specific types of programming activities while mildly drunk (the "mildly" part being quite crucial, for me this means two beers or a couple of slowly sipped glasses of whiskey). One is getting a large amount of boring mindless boilerplate out of the way quickly because the alcohol helps me not get too distracted from sheer boredom. The other is re-architecting high level design after getting stuck on a flawed approach - it seems easier to devise and consider more "out there" ideas without getting too bogged down in implementation details prematurely.
Obviously, that's just my personal experience and while I'm quite confident in my sample size, I wouldn't generalize it to anyone else. YMMV.
There are certain types of code which I can unequivocally write better after a few drinks. It's honestly mostly low-complexity drudge work which needs to get done but when sober I can't power through it as fast due to (a) boredom and (b) overanalysis of simple tasks.
This certainly isn't all the code I write (far from it) and it's not for everyone, but it's definitely true for me. That's why I don't think saying alcohol and code can never mix is right, but I agree that it shouldn't be a daily occurrence or the central aspect of company culture. I don't think an optional, after-work happy hour on occasion is such a bad thing though.
There is something called the Ballmer Peak, which has even been demonstrated in one study. Up to a point, the theory goes, creative work benefits from mild intoxication. Beyond that point, productivity goes out the window. For me, I believe that point is around two drinks. For you, it could be teaspoons. Either way, I wouldn't generally drink before the end of the work day.
Personally, I find coding is hardest when you're blocked or stumped. Sometimes it helps to turn off the inner critic and experiment with code in a way that might feel unproductive during normal work hours. How I approach a problem outside of work is my business as long as the solution is solid.
This should go without saying, but everyone's physiology is different. While most people get drowsy from pseudoeffedrine, it makes me hyper. That's why even if one treatment works for most people, it might not work for you.
I'll add that alcohol starts as an upper. It gives you a buzz that makes you feel good and want to do stuff. That's obviously beneficial if you can focus it on a work-related task. Several people here corroborated that hypotheses by saying they do. I've done it, too, in many situations.
Alcohol definitely blunts fast reflexes. If it also hinders coding, it's not for the same reason. If I had to guess, a little could fix anxiety and perfectionism, while a lot will leave you too incoherent to make something work at all.
> If I had to guess, a little could fix anxiety and perfectionism
This is exactly what happens to me, so I sometimes will code after a bottle of beer or a glass of whiskey. But it has to be little - more alcohol and I start losing focus.
For me, it can be a matter of actually doing it. I often suffer from analysis paralysis, so being a little tipsy means that I will actually write the thing. It'll be terrible, but it'll get done, and then sober me can go back and clean it up.
Or I'll go to far, write it, and it'll be unusable.
I used to do this sometimes in university. Haven't done it since entering the workforce, but they say sleep deprivation results in similar performance to being drunk. Not proud of it but I've found myself cornered into nightmare sleep deprived coding marathons by analysis paralysis / procrastination a number of times over the last few years. Alcohol might be preferable.
Back in university days I often wrote assignments while tipsy and then edited them when sober. Cider was just perfect for silencing the inner critic to get some thoughts to paper.
From what I understand, there's a substantial body of research indicating that a slight suppression of the prefrontal cortex can reduce the sorts of inhibitive filters that constrain creative thought. Too much, obviously, and you impair your cognitive ability. Too little, and self-doubt and over-analysis rules.
Anecdotally, I've noticed that I'm significantly more fluent in my third language when I've had a drink or two. I get many, many more compliments. When I'm totally sober, I tend to trip up more and overthink the grammar.
There are lots of ways to reduce a hyperactive prefrontal cortex, including training (practicing art, meditating, etc.), but alcohol is by far the cheapest, quickest, and easiest.
I sometimes code after drinking. Not often, because I'm obviously sharper when completely sober. But when I'm very stressed, my cognitive potential is significantly reduced. Taking the edge off with a single beer results in a great increase of productivity then.
Also, if you think people can't get actual, working code written when shitfaced, then I guess you haven't met the demoscene crowd ;).
This may be the case. I generally say I can't code worth a damn if I've had a beer or two, because my ability to really focus goes way down. But I've also had the experience of getting a bit buzzed and absolutely plowing through a whole bunch of easy-to-write code and enjoying it quite a bit, whereas it was otherwise kind of dull work.
>I just absolutely do not understand how that is even possible. If I have ONE beer, it throws off my ability to write good code, or hold all of the concepts in my head.
There are times when a problem is intractable and I get frustrated through thinking too much about an issue. Alcohol, like caffeine, has its place. I want to stress that I'm not talking about getting hammered at the office, or even mildly drunk, I'm talking about the fact that for some people, a single beer after many hours of work can be helpful in calming them down enough to focus on the whole problem again.
Alcohol can certainly have performance-enhancing effects: comically, the first Olympic disqualification for doping wasn't for steroid use or anything similar - it was for a man drinking "two beers" before his shooting match to calm himself down enough to operate at peak levels.
I can do exploratory coding when drinking, but I won't waste my time or an employers trying to write production code while drinking. As you note, it just doesn't work.
I just absolutely do not understand how that is even possible. If I have ONE beer, it throws off my ability to write good code, or hold all of the concepts in my head.
One of the weekly coworking meetups I go to always ends at a brewery (there is a brewery next door to the hackerspace where it is held), and while it is certainly a lot of fun being there brainstorming things, I don't understand how anybody gets actual code written after drinking.