Friends don’t let friends code drunk

Drinking and programming often go together, but is that really a good idea?

By  


Should developers be forced to do this?

Image credit: REUTERS/Daniel Aguilar

Last year I wrote about whether drugs ("mind expanding" ones like marijuana and LSD) help programmers to write better code (some say yes, but I don't think so). Today, I'm wondering whether a much more common drug, alcohol, is good or bad for code writing. We all know there are lots of things you definitely shouldn't do after a few adult beverages, like driving, calling old flames or getting tattoos but what about doing a little code optimization or refactoring? 

This was inspired by a GitHub project that was just brought to my attention, called gitdown. Created by Alex Qin and Geoffrey Litt during hackNY's spring 2013 hackathon, where it won first place, gitdown is, in a nutshell, a tool for preventing you from committing code when drunk. It uses the Arduino DrinkShield, an open source breathalyzer, which gets triggered as a git commit hook. When you try to commit something to GitHub, it first requires you to blow into the breathalyzer. If your blood alcohol level is too high, you can't commit anything.

Here's a video of gitdown in action

It's a fun, goofy project that has generated a little chatter on Hacker News about whether drinking and coding are a good (or, at least, not a bad) mix. Some people thought so.

"I've written and committed my best bugs when drunk. Undoing them was a valuable learning exercie." csmuk

"Slightly drunk is fine, for me it helps for not overengineering things and i just write code that works." NicoJuicy

"I've written both my greatest (and most ingenious) code, and my absolute worst code while drunk. It seems to send me to one or the other extreme." girvo

It's certainly pretty easy to mix alcohol and code. Lots of the companies that I worked out had beer in the corporate fridge and developers wouldn't be shy about cracking them open at their desks late in the day (and sometimes not so late). And, of course, lots of coding goes on at home and at strange hours when your own private stash of booze is readily available. So, there's probably more code out there written by someone who's had a few than most people probably realize (insert your own joke about your least-favorite piece of software here).

As for me, during all my years as a developer, I didn't do much drinking and coding. Once I had a beer or two, writing code and trying to solve complex problems was about the last thing I wanted to do. I was at my best coding when the only drug that I was on was caffeine and could think clearly. It's hard for me to believe that really good software development or design can get done under the influence.

Of course, as some commenters noted, you can write - and even commit - code drunk pretty safely assuming you're using some type of version control software; in that case, any damage can always be undone later. There is one thing, however, you definitely should never do drunk:

"You should be able to commit all you want all night long, but should not be able to push." watt

So, go ahead and enjoy your adult holiday drinks while programming But, just to be safe, wait until the sober light of the next day to make that brilliant code live - assuming you still think it's brilliant.

Read more of Phil Johnson's #Tech blog and follow the latest IT news at ITworld. Follow Phil on Twitter at @itwphiljohnson. For the latest IT news, analysis and how-tos, follow ITworld on Twitter and Facebook.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question