Programming magic: Rituals and habits of effective programmers

By Amy Bennett, ITworld |  Development, programming 13 comments

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 Servee.com, 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."

13 comments

    serious coding means headphones on...
    bachelorstaff
    bachelorstaff 27 weeks ago
    I have to say i am very impressed with the way you efficiently website and your posts are so informative. You have really have managed to catch the attention of many it seems, keep it up!
    Anonymous 2 years ago
    Having ADD, keeping focus is sometimes difficult. I can overcome this by using background music (instrumental so I don't focus on vocals), played loud. My favorites are big sound classical pieces. The sensory overload lets me keep on track. I also agree strongly with getting away from the keyboard with pencil and paper to plan and organize. It makes for much a more structured and correct project.
    Anonymous 2 years ago
    Some old C64 or Amiga demoscene music quietly on the headphones, two bottles of water and some chilinuts on side keep me in the zone. If I want really to concentrate, I come in to work on holidays (the office is empty) and forget the chilinuts.-MV
    Anonymous 2 years ago
    One word: Modafinil :>)
    Anonymous 2 years ago
    I did my best coding wearing orange lens ski goggles. Separates you from the norm and gets the mind thinking creatively.
    Anonymous 2 years ago
    Whenever I find the solution to a specific problem I don't immediately start implementing it. I just play some games (computer games) or listen to songs or watch a movie or give replies to mails or do anything that's not related to the problem/ coding. I just take a break and then get back to work.
    Anonymous 2 years ago
    Unfortunately most managers do not understand that developers can very well be productive writing code in their heads before they commit it into source control. I don't know how many times I have heard a boss of mine complaining that so so is taking too many breaks w/e without regard to that persons actually productivity. All they see is if you are at your desk pecking away at a keyboard or not.
    Anonymous 2 years ago
    When I was doing my Doctoral Thesis building a distributed & autonomous p2p self-healing file system I used to do one of two things depending upon the time. I lived in Perth Western Australia at the time, which is right on the peninsula in Maylands which faced the Darling Ranges. In a similar fashion to your first story about the chap that delayed the coding till the last stage, I did the same.Night:I would go into the kitchen with the lights out and make toast on the stove using a camp-style toaster. German Rye Bread with an obscene amount of honey (Iron Bark or Blue-Gum were the favourites). I would during the eating of each slice and waiting for toasting lean on the servery and look out to the mountains, de-focus and stare mostly at the lights going on and off against the ranges. I assume it was the town of Kalamunda I was staring at, and think quietly about the problem, how to solve it, eat toast. Five or six slices and an hour or so later I'd wander in, settle down again with a glass of ice cold milk and commence solving the tiny chunk of a problem I was working on that night, dynamic hash tables or what ever.Day:I would take an old fashioned clutch pencil and a thermos of coffee and wander down the peninsula to one for the bench seats and spend an hour or more as necessary staring out again de-focused on the river and people walking/cycling/blading past. If I needed any storage I would use the notepad and pencil.. which was frequently because I have gold fish memory. Coding time, was always a glass of super cold milk, and listening to nectarine demoscene music.. down very quietly. I know most of the tunes after 10+ years of listening and it would keep the easily distracted side of my brain quiet. If it was a bit too "banging" I'd tune into something quiet such as Soma-FM's "groove salad", close the door, relax with my feet up and begin after a stretch and shoulder/arm joint cracking session. Also using my SGI Octane and HP9000 c3700 or the VAX (VMS!) were emotionally very relaxing/comforting and pleasurable. Using the Mac's or Windows machines ..were just too distracting. There is too much "Going on" around your screen and the widget set.Al.
    Anonymous 2 years ago
    I agree with the pre-planning and planning stages of staying away from your computer. My clearest thoughts of program design come to me when I'm commuting, gardening, baking - anything that isn't in front of my computer. When I have this time to think - I am way more productive when I actually do the coding.For me, when I'm coding I like to watch movies like 'Real Genius,' 'The Core,' or other feel good type of geek movies. Especially ones that I've seen 100 million times before - it's comforting and takes that part of my wandering brain aside so that I can focus. I have to have at least two bottles of water on my desk at all times as well. -D
    Anonymous 2 years ago
    two Redbulls on ice, and a can of pringles keep me in the zone
    mulderjoe 2 years ago
    I'm listening to "Pure Phase" by Spiritualized at the moment. Album du jour.

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      DevelopmentWhite Papers & Webcasts

      White Paper

      HP NonStop SQL Fundamentals whitepaper

      This whitepaper offers a detailed look into the fundamentals of HP NonStop SQL solutions. See how this system delivers unprecedented levels of application availability with fail-safe data integrity and meets the needs of enterprises with large-scale business critical applications.

      White Paper

      Nebraska Medical Center case study

      See how the Nebraska Medical Center implemented a SQL solution to make information more readily available to streamline operations, improve patient care and facilitate medical research with an enterprise solution running on HP NonStop servers.

      White Paper

      Concepts of NonStop SQL/MX

      For DBAs and developers who are familiar with Oracle solutions and want to learn about NonStop SQL/MX, this whitepaper provides an overview of the similarities and differences between the two products-with a specific focus on implementation.

      White Paper

      6 Things Your CIO Needs to Know About Requirements

      If your organization is not predictably successful on technology projects, there is likely an issue in requirements. CIOs must take action and own requirements maturity improvement. There are 6 main things a CIO must know about requirements.

      Webcast On Demand

      User Experience Monitoring

      In this webinar, you will learn hints & tips for improving end-user response times from Forrester Research analyst, Jean-Pierre Garbani.

      Sponsor: Nimsoft

      See more White Papers | Webcasts

      Ask a question

      Ask a Question