Jan 24, 2009
How to enter the Zone at will

You know what I'm talking about. Programming can be the best of times or the worst of times. Sometimes the fingers seem clumsy on the keyboard, tool after tool acts flaky, we scream and curse, we become aware of the huge tower of complexity we rely on. At other times all thought flies except for this one thing we're working on right now. The fingers fly, the thoughts hum, and we eventually exit the trance amazed at what we have accomplished, at how cool it all is. We call this the Zone, writers and artists call it the Muse, and it has taken a while to realize that it's just a mental state [1] only loosely influenced by external factors.

I too have chased after the Zone day after day for many years as I struggle to bring programming ideas to life. Like conversation, programming can give you anything but consistency. You never know if this session will be good or bad. Sometimes things are good from the moment you hit the keyboard. Most times, though, you struggle for a while before you find it, before you lose yourself. On most days it takes me 2 hours just to get going, to stop noticing the mechanical actions between thought and software. Since getting going takes so long I've gotten used to the idea that programming needs large quanta of time. I need my time to be divided up into chunks at least 4 hours long. The truly great sessions require 8 hour sessions, multiple of them broken up only by sleep without thought to external stimulus or time of day.

Or so I thought until now. A few days ago I noticed that I've gone months without hacking for 4 hours straight. My output is not reduced, indeed I'm accomplishing as much as I ever have. These days it seems I can make something out of even the stray hour that gets thrown my way. What changed?

What changed was that I started doing TDD. I started breaking big ideas down into lists of stories in a little text file, picking a story, writing test cases for it. That was it. Somehow, it seemed, just having stories and test cases served to focus the mind.

Did you ever find yourself thinking, "Man, for all the lengthy reasoning if I'd just heard about reason x I'd have been on board from the start?" Forget exercise-is-good-for-you, bruce-lee-beating-up-the-bad-guys, girls-like-it -- if I'd only known it would improve my posture I'd have started doing weights long ago. Forget politeness, a smooth ride, traffic safety -- if only I'd been reminded of speed limits and traffic cops and tickets, I'd have slowed right down.

And I would have been all over TDD if I'd known it would get me to the Zone at will. Forget all the lengthy rationales about project success rates, the agile manifesto, dealing with changing requirements, avoiding regressions. When I think about all those years of nursing my RSI, wondering what I was doing wrong after a lengthy disappointment, psyching myself up to the level of focus and discipline necessary for long hours at a stretch, procrastinating to avoid the grind, when I think about these things, oh man. If only I'd known.

(Inspired by this thread)

Comments gratefully appreciated. Please send them to me by any method of your choice and I'll include them here.

RSS (?)
twtxt (?)
Station (?)