When programmers can write no more

In the digital age, writer's block has morphed into programmer's block. The cure? Fire up the Skittles.

It happened to Ernest Hemingway, F. Scott Fitzgerald and Tennessee Williams. All wrestled with monumental cases of writer's block. Now you can add Jon Bentley and thousands of other modern-age writers to the list.

But Bentley isn't a writer of plays or poetry. He, first and foremost, is a writer of code. And in the digital age, his affliction is called programmer's block. The "I've hit the wall" feeling is just the same as writer's block, however, it happens when the programmer's brain is unable to fathom where that next line of code will come from.

When Linux enthusiast site Slashdot earlier this week conducted a programmer's block session online, hundreds of developers chimed in with their favorite antidotes. The question: "What do you do if your productivity drops to two lines of code a day, and you just sit and stare at the code and feel like you don't know how to do it anymore?"

Some coders said programmer's block is nothing more than a blip on the cathode-ray tube.

"I've never thought about it," Linus Torvalds, who is credited with authoring Linux, told ZDNet News.

When asked how he copes when the urge to code disappears, Torvalds said via e-mail: "Whenever I don't feel like programming on something, I've had other projects. Or I've just done something else altogether, like reading. I think it turns into 'programmer's block' only when you feel you have to do something specific, and I've been able to avoid that."

"I've never suffered from it," said systems software consultant and XML specialist Bill Schindler. "Why we let people get away with silly things like writer's block/programmer's block, I don't know. If you called the plumber and he told you he couldn't fix your leaky pipes because he had plumber's block, would you be understanding? The only cure for programmer's block is start programming something, anything -- just as the only cure for writer's block is to start writing."

But for those who do succumb, what's the solution? There seemingly are as many home remedies as there are styles of programming.

While some famous writers turned to the bottle to break a block, programmers seem to prefer caffeine and sugar -- in a variety of forms. Programmers talk about upping their already legendary consumption levels of everything from double-tall lattes to chocolate bars as a sure-fire way to beat the blahs.

"The only way to cure programmers block is a direct infusion of Skittles and Mountain Dew intravenously, keeping the brain in an alert and creative state," said one Slashdot poster.

Others say they prefer a more low-impact antidote -- a long hike, 12 hours of sleep, a little golf, meditation.

Meditation? "I like to make an analogy to meditation as being like defragging the hard drive, flushing memory cache, and throwing out temporary files," offered another Slashdot poster.

A left-brained activity, like art, sometimes can counteract the block, suggested Allen Harkleroad, a principle with GMP Services Inc.

"If I get blocked I usually go do something of an artistic nature like using Painter, CorelDraw or PhotoPaint, sometimes even work in 3D Studio Max or even Adobe After Effects. Frequently the problem I was having gets resolved while I am immersed in less stressful things."

Simply giving one's brain a rest seems to work for some developers.

"I don't call it programmer's block; I think of it as stagnation," said Dave Winer, CEO of UserLand Software Inc. and commander in chief of the scripting.com programmer's site.

"There are sometimes whole weeks where I don't really write any code, although I think I am. In the end nothing useful comes out of it. My mind is still processing stuff while I'm idling, I'm learning what it's like to use the thing I did in my last burst of productivity."

Ironically, one cause of programmer's block is the infusion of new tools, languages, class libraries and compilers all designed to make coders more productive. But the result, as often as not, is information overload, resulting in shutting down the creative process.

Java has spawned the need for a whole new class of programmers and skills. And just two months ago, Microsoft Corp. (msft) introduced yet another new language, C# (pronounced C sharp), to the market. The idea behind C# and a number of newer languages and tools is to isolate developers from much of the underlying complexity of their tasks, thus -- at least in theory -- making programming so easy that even nonprogrammers can do it.

But have any of these developments done much to head off programmer's block?

Bentley, a member of the technical staff at Bell Labs and author of the programming classic "Programming Pearls" (Second Edition, Adison-Wesley Inc., 2000) argued that programmer's block could become even more problematic, simply because of the way programming is headed.

"The real frustrating thing with modern day programming -- where you try to assemble a bunch of components, which should fit together -- is making the tools work together as gracefully as possible," Bentley said. "Say you have a rough outline for assembling a Web front end or a Visual Basic front end with Java glue, to a database back end ... two to three to four things that combine together. It's bad now and going to get worse."

In the end, the best advice may be the simplest: Remember what's really important. As one Slashdot poster opined: "Coding may be life, for some of us... but life is not coded."