Programming magic: Rituals and habits of effective programmers

When a baseball player steps into the batter's box, tugs at his gloves, taps his feet, touches the bat to home plate, the casual observer is thinking: "get on with it already you superstitious nut." (This video of Nomar Garciaparra is a textbook example.)

But for the players, these routines "bring order into a world in which players have little control," writes anthropologist George Gmelch in a paper titled Baseball Magic. "And sometimes practical elements in routines produce tangible benefits, such as helping the player concentrate." Gmelch notes that "A ballplayer may ritualize any activity--eating, dressing, driving to the ballpark--that he considers important or somehow linked to good performance."

programming habits
Photo by visualpanic

5 Good Programming Habits

  • "The best trick I have is to type the sequences/use cases like a story before I write any code. The outline I create is read over and over, tweaking as I go." -- Dan Douglas
  • "Solve small, individual problems (The rule of 'encapsulation'). If I try to make one part of my code do too much, then I've invited trouble." -- Sean Devlin
  • "I like to write a routine first as pseudocode in comments, then translate the comments into source code. I find that this is a much faster method for me than writing the source code first. Any mistakes I make in the pseudocode are more easily fixed there than if I wrote the code first. As a bonus, I have accurate and useful comments when the routine is completed." -- Jeffrey Henning
  • "Make improvements often -- even if they are small -- so you are always making some progress." -- James Stauffer
  • "I make sure that I get a reasonable amount of sleep and that I come back to each piece of code/design/etc. after 'sleeping on it' so that I see/think about it from different angles and states of mind. This helps with everything." -- John Mitchell

And in this, the rituals performed by baseball players aren't all that different from the habits of productive programmers.

Issac Kelly, Lead Developer at, explains it this way: "To me, programming is really the 'last mile' to getting something done. When I do the planning and specifications, I go on lots of walks, take lots of time with my wife, and really do as little work in front of the computer as possible.  The more I plan (in my head, on paper, on a whiteboard) the less I program; and all of my rituals are to that end." Before sitting down to a coding session, he gets a big glass of water, takes everything off of his desk, and closes out all programs and e-mail, keeping open only his code editor. The office door is shut, and some sort of music is playing ("typically an instrumental only, like my 'Explosions in the Sky' pandora station," says Kelly).

[ For more odd tech habits, read IT superstitions: Astrology, sacrifice, and demons and Would a server by any other name be as functional? ]

Still not convinced of the baseball/programming analogy? Consider this:

One cup at a time

Dennis Martinez, the first Nicaraguan baseball player to play in Major League Baseball "would drink a small cup of water after each inning and then place it under the bench upside down, in a line. His teammates could always tell what inning it was by counting the cups."1

Sean Devlin, a programmer at Servoy, employs a similar time-tracking method. "I keep a scratch pad open on my computer," says Devlin, "and I add a line about every fifteen minutes with what I did, no matter how minuscule. This has a couple of effects. First, if I don't have anything to write, then I know I wasn't concentrating. Second: When programming is tedious, and I feel like I'm not being productive and I look at the twenty-five things I did in the last half hour and it gives me motivation to stay focused."

Hollywood, take me away

Dan Douglass, Technical Director at InSite Interactive, finds that "reading outlandish books or watching over the top movies/tv shows seems to help trick [his] mind into critical thinking." That's not so different, really, from former Yankee pitcher Denny Neagle's habit of going to see a movie on days he was scheduled to start.1

The way to a man's heart

"Wade Boggs ate chicken before every game during his career" and "infielder Julio Gotay always played with a cheese sandwich in his back pocket."1 So should we be surprised when Aaron Overton says he does his best work at Denny's? "I take my laptop and go to diners and restaurants (free wifi is key!)," says Overton. "Background noise of people talking, dishes clanking, and all that then just blend into the background and the focus arrives."

1 2 Page 1
Page 1 of 2
ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon