Darrell Norton's Blog [MVP]

Sponsors

The Lounge

News

  • Darrell Norton pic

    MVP logo

    View Darrell Norton's profile on LinkedIn

    Currently Reading:

    weewar.com

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
What's the best drunk code you've ever written?

Steve Hebert and I came up with this “Friday question”:

What's the best piece of code you've written drunk, on medication, etc.?

Best here can be loosely defined as good, humorous, obfuscated, commented, etc.

Mine was written under a Sudafed-induced state. Sometimes my allergies bother me so much I can’t stop sneezing until I’ve taken half-a-dozen of those little red pills. It keeps me up all night too. (My best friend’s wife is a pharmacist, so I know what I’m doing. Don’t try this at home. Side effects include drowsiness, inability to sleep, and intermittent narcolepsy. Keep your hands and legs inside the blog post at all times.) But I digress.

I was in the zone, cranking out the code. I thought I was making all sorts of great progress. Then I went to bed. The next day I woke up and encountered things similar to what these people found. I had to rewrite most of it, but it was an illuminating experience. Now when my allergies act up and the recommended dosage of Sudafed doesn’t work, it’s time to go home.


Posted 07-16-2004 6:26 AM by Darrell Norton

[Advertisement]

Comments

Paul Wilson wrote re: What's the best drunk code you've ever written?
on 07-16-2004 3:36 AM
We used to get a beer or two frequently at lunch on Fridays where I used to work a few years back. One fellow never got a beer, and one day he was stressed enough that he did. He told us the next week that he was still getting the bugs out of the code he wrote that afternoon after that one beer. He never got a beer at lunch with us again. :)
Darrell wrote re: What's the best drunk code you've ever written?
on 07-16-2004 3:54 AM
That's awesome! Lightweights always make for great entertainment. :)
David Hayden wrote re: What's the best drunk code you've ever written?
on 07-16-2004 4:03 AM
// TODO: write something here as soon as I finish my beer. ;)
Mike Carter wrote re: What's the best drunk code you've ever written?
on 07-16-2004 4:03 AM
I wish I had a drunk coding story, but the truth is that once i geta buzz going, I lose all motivation to do anything productive.
Darrell wrote re: What's the best drunk code you've ever written?
on 07-16-2004 4:21 AM
David - that's TODO-Driven Development! Find out more here: http://secretgeek.net/TODO_driv_dev.asp
Darrell wrote re: What's the best drunk code you've ever written?
on 07-16-2004 4:23 AM
Mike - that's why Sudafed is great... no motivation lost yet coding ability is just as impaired!
Jason Row wrote re: What's the best drunk code you've ever written?
on 07-16-2004 4:52 AM
I'm in the same boat as Mike. I don't do much drinking and coding so I have no stories to tell.

Question for next week, what music do you listen to when you code? Seems like Darrell likes Britney's In the Zone CD. <grin>
Jason Row wrote re: What's the best drunk code you've ever written?
on 07-16-2004 5:04 AM
Maybe I'd drink more if I had access to one of these.

SkyBox Personal Beverage Vendor by Maytag
http://208.29.6.159/MainPage.aspx
Jason Row wrote re: What's the best drunk code you've ever written?
on 07-16-2004 5:07 AM
Whoops ... try this URL instead.
http://www.skyboxbymaytag.com/
David Hayden wrote re: What's the best drunk code you've ever written?
on 07-16-2004 5:40 AM
That TODO-Driven Development is hilarious and hits a little too close to home :)

Speaking of Test-Driven Development :)

I remember watching Jim Newkirk's webcast on TDD. He mentioned that during TDD you write a test, watch it fail, and then write the simplest code possible to pass a test, even if you know the code is way too simplistic and will need to be changed in the future.

Can you think of a better way to follow the core principle's of TDD than after a few beers? I can gurantee that after a couple of beers all my tests will initially fail and my class methods will only return primitive types :)
Anonymoose wrote re: What's the best drunk code you've ever written?
on 07-16-2004 6:02 AM
Simcity 2000 for DOS.
Darrell wrote re: What's the best drunk code you've ever written?
on 07-16-2004 6:23 AM
David, maybe it should be Test Drinking Development?
Darrell wrote re: What's the best drunk code you've ever written?
on 07-16-2004 6:24 AM
Jason - yeah I like Britney! She's hot, and sings well too! :D
Steve Hebert wrote re: What's the best drunk code you've ever written?
on 07-16-2004 11:11 AM
Back in the fall of 1990, I was writing a medical billing system in FoxPro 1.0. On my customer screen, I wanted a history of all charges on the account and that really required a multi-column list box (charge id, charge description, qty, cost, etc.). At that time, FoxPro didn’t have a listbox as we know it today, much less something multi-column.

I was at the bar until closing time drinking a lot more beer than I care to (or can) remember. I ended up back at my apartment alone (so it wasn’t THAT great of a night) and tried going to bed. I couldn’t sleep and I started thinking about that listbox. I thought to myself – I can write this. Now I think the belief you are capable of doing anything is actually one of the advanced stages of drunkenness. I kept drinking because I knew if I stopped, I’d get too tired to continue. After an hour and half I had a working (or so I thought) model complete with a highlight bar that moved up and down, the data scrolled and everything was right with the world. I fell fast asleep on the couch.

The next day I had to recover from my hangover so that evening I sat down to see how it ran. Well the code drew the line properly and managed some of the up and down cursor movement and scrolling. I say some because I think it only worked in one direction but it started hopping over records when it scrolled. And the code blew up more often that it worked. I spent a full day tearing apart that code and rebuilding it, but some of the basic structure stayed the same.
Steve Hebert wrote re: What's the best drunk code you've ever written?
on 07-16-2004 11:22 AM
"Lightweights always make for great entertainment." - Truer words have never been spoken!
Darrell wrote re: What's the best drunk code you've ever written?
on 07-18-2004 9:58 AM
FoxPro - Steve you are a much more experienced person than I! I only messed around with it a little when we had to interface with a government system.
Steve Hebert wrote re: What's the best drunk code you've ever written?
on 07-19-2004 4:29 AM
I am lucky! I always display my FoxPro experience in a 24pt bold/italic font on the top of my resume. Whenever I see a post where people are arguing about which language is best, I'm tempted to jump in with "the greatest language ever was FoxPro 2.6" and try to say it with a straight face.

A government system? It seems like FoxPro always pops up in the strangest places.
Darrell wrote re: What's the best drunk code you've ever written?
on 07-19-2004 6:42 AM
Yep. It was quite interesting figuring out how to use it and interact with it! :)
Dave Brookes wrote re: What's the best drunk code you've ever written?
on 07-19-2004 8:42 PM
Fix 1 - Check code in SCS Friday lunch and start from that revision on Monday no matter what.

Fix 2 - Keep drinkin until too bladdered to work again for 2 days.

Fix 3 - Switch careers. Work for Guiness.
Darrell wrote re: What's the best drunk code you've ever written?
on 07-20-2004 2:04 AM
Work for Guiness, I like that. Or one of those micro-breweries!
Steve Hebert wrote re: What's the best drunk code you've ever written?
on 07-20-2004 8:15 AM
Wow! This guy (http://guessman.blogspot.com/) just slammed me based on this post. Although he mistook me for a french-man - it looks like the guessman guessed wrong. Preparing response...
Darrell wrote re: What's the best drunk code you've ever written?
on 07-20-2004 8:32 AM
Steve - I'm not sure I understand his post. It doesn't seem like a slam? Or maybe he changed it since you posted.
Steve Hebert wrote re: What's the best drunk code you've ever written?
on 07-20-2004 10:08 AM
It's a funny slam. He sets up the quotes saying "(but at the same time, what do those French know...."


Darrell wrote re: What's the best drunk code you've ever written?
on 07-20-2004 10:14 AM
Ah, I see now!
secretGeek wrote re: What's the best drunk code you've ever written?
on 07-20-2004 12:22 PM
You crazy alcoholic ranters have shown up in my referer log.... now put down that drink and get back to work you ninnies!

(ok, i admit i've coded under the influence at times, more than a few times really, and find a terrible habit of writing frameworks within frameworks... shooting off on tangents that seem to be aimed at making the code ultra-reusable... and yes, peppering it all the while with some piss-funny 'todo' and 'hack' tokens... i worked on a project in london where the original developer claims he wrote it all while stoned. there's some evidence of this in the code (strange extensibility techniques, and one hilarious easter egg). the program is used by many large european banks and he's a multi-millionaire now. such is life.)

Darrell wrote re: What's the best drunk code you've ever written?
on 07-21-2004 1:39 AM
I've been visited by secretGeek. Coolness!
Justin wrote re: What's the best drunk code you've ever written?
on 07-21-2004 8:48 AM
C#, the C is short for Cabernet right?
Jason Row wrote re: What's the best drunk code you've ever written?
on 07-21-2004 2:45 PM
How appropriate of secretGeek to have a "I'll be drunk" Tech-Ed 2004 image on his site when I visited from his comment.

Steve Maine wrote re: What's the best drunk code you've ever written?
on 07-21-2004 4:11 PM
The coolest piece of code I've ever written while in an altered state was a piece of OpenGL code I wrote for a graphics class in college.

It was a sort of psychedelic screensaver thing -- an intertwined, counter-rotating system of spheres that exhibited symmetric, simultaneous motion in several different directions at once. It looked pretty sweet, but sort of tended to induce motion sickness.

Anyway, the only way I could get all the matrix math to work out correctly was to get drunk enough to stop thinking about it. Looking at the code today, I have no idea how it works. But it seemed to make sense when I wrote it, and furthermore -- it worked!
Darrell wrote re: What's the best drunk code you've ever written?
on 07-23-2004 5:11 AM
Drunk code that worked, the first one yet on this post! At least you get a few demerits for non-readable code. :)
zac wrote re: What's the best drunk code you've ever written?
on 09-30-2004 12:29 AM
um this may me a dumb qestions but what is a drunk code?
Darrell wrote re: What's the best drunk code you've ever written?
on 09-30-2004 1:47 AM
zac - it's code written when you were either: drinking alcohol or under the influence of legal drugs (such as Sudafed).