Chad Perrin: SOB

11 March 2008

insomnia and productivity

My insomniac productivity a few days ago wasn’t just geared toward writing lengthy rambles about the differences between various forms of philosophical libertarianism. I also wrote code — in particular, I wrote an entire program from start to finish, inspired by code I found online for doing the same thing that (frankly speaking) sucked.

I wonder why it was such a productive night. As I think about it, I remember that my experience in years past mirrors the stereotype: geeks that stay up all night hacking away at something that totally consumes their attention at the time, producing far more in a couple nights’ work than your average professional does in a month.

The phenomenon has been termed hack mode:

a Zen-like state of total focus on The Problem that may be achieved when one is hacking (this is why every good hacker is part mystic)

More about it, from the same source:

Being yanked out of hack mode (see priority interrupt) may be experienced as a physical shock, and the sensation of being in hack mode is more than a little habituating. The intensity of this experience is probably by itself sufficient explanation for the existence of hackers, and explains why many resist being promoted out of positions where they can code.

Recently, Sterling “Chip” Camden (of Chip’s Quips and Chip’s Tips) recently wrote on the subject of geek productivity. It was cast as consultant productivity, of course, because that’s the sort of geek he is — but it gets into the same concepts as the Jargon File definition of “hack mode”.

Compare his words:

Focus. One reason why IT pros don’t always do so well in social situations is that they have the power to concentrate intently on one problem to the exclusion of everything else. (No, honey, I wasn’t ignoring you — I actually didn’t hear you, even though you were standing right beside me and speaking clearly. I might have even said “uh huh,” but that was just a 202 response.) We geeks need to maximize this ability in order to be effective. We can’t allow ourselves to be interrupted for “just a minute” to answer a question. The instant we break concentration, the entire problem that we were modeling in our head drops on the floor and shatters into a million pieces. This is why you shouldn’t answer the phone, e-mail, or chat during these periods.

. . . with these from the “hack mode” entry at the Jargon Wiki:

Some aspects of hacker etiquette will appear quite odd to an observer unaware of the high value placed on hack mode. For example, if someone appears at your door, it is perfectly okay to hold up a hand (without turning one’s eyes away from the screen) to avoid being interrupted. One may read, type, and interact with the computer for quite some time before further acknowledging the other’s presence (of course, he or she is reciprocally free to leave without a word). The understanding is that you might be in hack mode with a lot of delicate state (sense 2) in your head, and you dare not swap that context out until you have reached a good point to pause.

Crazy-late hours of intensive hacking lend themselves naturally to entering, and sustaining, a deep state of “hack mode”:

  • Other (saner) people aren’t around to interrupt. They’re all asleep. This provides additional safety when juggling eggs.
  • The requirement of keeping from disturbing others inhibits the tendency to engage in distracting entertainments (like TV). This almost forces one to focus entirely on one’s work. Only something like reddit stands in the way.
  • Subjectively speaking, it seems that the wee hours of the morning lend themselves to an almost surreal, abnormal perspective. Inspiration can be found in odd places under that sort of influence — which leads to new ideas coming to mind and being explored that, by the light of day, may have been dismissed immediately as “crazy talk”.

Discovery of these benefits to late nights coupled with the heady experience of “hack mode” itself (it’s like a powerful psychologically addictive drug — really and truly), along with other factors, surely contributes to the increasingly nocturnal and insomniac (sometimes to self destructive extremes) tendencies common in “larval stage“:

a period of monomaniacal concentration on coding apparently passed through by all fledgling hackers. Common symptoms include the perpetration of more than one 36-hour hacking run in a given week; neglect of all other activities including usual basics like food, sleep, and personal hygiene; and a chronic case of advanced bleary-eye. Can last from 6 months to 2 years, the apparent median being around 18 months. A few so afflicted never resume a more `normal’ life, but the ordeal seems to be necessary to produce really wizardly (as opposed to merely competent) programmers.

This makes a lot of sense, considering the fact it generally takes ten years to become a competent programmer. The same is essentially true of anything — it takes ten years’ worth of work to become truly proficient (what the unambitious might call a “master”) in any skill that embodies great technical challenges. It’s not the actual chronological period of ten years that matters, of course — it’s the amount of time and effort invested in learning and practicing the skill that matters. It just observably tends to take about ten years for most people who consistently pursue such skills to reach a level of significant proficiency.

I’m prone to insomnia — it comes and goes, sometimes afflicting me for a week at a time, occasionally longer, sometimes only one night here and there. I try more and more all the time to adopt a more “normal” sleep schedule, but I’m simply not nearly as effective at this as I’d like. The insomnia keeps coming — and the definition of larval stage holds a clue to one of the reasons for it:

A less protracted and intense version of larval stage (typically lasting about a month) may recur when one is learning a new OS or programming language.

This obviously isn’t the sole reason for my bouts with insomnia, or even the primary reason. It is, however, probably a contributing factor.

I don’t think I have a perfect handle on the forces at work, however — even those in my own head. The above-listed benefits can’t be the only reason that, when I allow it, insomnia can be so productive, for instance. It’ll bear more thought.

By the way, the program I wrote was a command-line utility that retrieves currency exchange rate data from the Internet and provides up-to-date translations between currencies. It was inspired by the train wreck of a currency exchange utility I found here. As of this writing, that program I found is hopelessly broken, in addition to being poorly written and essentially unmaintainable — thus my desire to write something better.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License