Migraines, Poker, and Code

The worst migraines are the ones I wake up with. Since the only hope for short circuiting migraines is to take something as soon as they start, I’ve missed the best opportunity to take any preventive action. Plus, it’s just damned discouraging.

This morning I learned there’s something worse than a night-time migraine and that is dreaming about having a migraine at the same time. When I woke up I was in an even deeper fugue than is normal for night-time headache-on-steroids state.

I say “fugue” even though I’m abusing a psychological term because part of my brain wanders off into disjointed thoughts–I think it’s trying to grab on to any distraction, while another part of my brain is cajoling my body into getting the hell up already. Today the wandering part of my brain made a connection between poker and coding that was fun and indeed distracting. (Fugues are like dreams and ideas engendered by smoking dope. They don’t often result in anything actually useful.)

I think the catalyst for the connection came from putting away one book–The Rules of Neighborhood Poker–and picking up another–Working Effectively with Legacy Code by Michael Feathers. The latter book comes straight out of what I think of as the rational programmer movement that includes refactoring. Crudely, the movement acnowledges that shit happens in programming and then goes on to answer the natural question “so, what can you about it without freaking out?”

Programming is a logical discipline practiced under chaotic circumstances, and thus it frequently results in messy code. Similarly, poker is a rational game played under random circumstances, circumstances which most often present a player with crappy hands. If it was only possible to play poker with perfect, or even just pretty good hands, it wouldn’t be a very popular game.

Consider that in any hand, one person, the dealer, is the one who picks the game. A dealer can even invent a game on the spot (so long as she explains the rules to everyone). Consider, too, that a player has to ante up before the dealer specifies the game. No ante? No play. Playing costs at least the price of the ante. Once a hand is dealt, a player has to play her hand the best way she can. There are rational ways to assess one’s choices. Sometimes the best choice is to fold the hand, but for an experienced and smart player, even a messy hand can win.

Crap happens no matter how well one plans, whether in poker or programming. In the real world, code serves a continually shifting set of priorities, just to mention one among all the butterflies flapping their wings in Brazil. At least with poker, the technology isn’t also changing!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s