The Flow – Programming in Ecstasy

I once worked in an office with a timed motion sensor light switch.  If it didn’t detect motion in the office for 20 minutes or so it would turn off the lights.

When I was programming “In The Zone” the lights would switch off repeatedly and often over hours of work.  Each time I’d flail my arms briefly to get the lights back and return to the task at hand, back into the zone.  Eventually I would get the hint, switch my mind off, stretch and go home to wife and kids.

I enjoyed being in the zone… greatly.  I lost track of time.  I lost awareness of my surrounds.  I was detached from everything around me and was immersed in my task.  It felt great but strangely I wasn’t really aware of that feeling when in the zone.

I’m confident, but not certain, that my programming work done in the zone was better.  I was able to tackle the most complex tasks more successfully.  I felt more productive — I don’t remember ever leaving the zone and looking back at my work as being poor.

Programming in the zone — or “The Flow” as it is known in psychology — deserves better understanding.  Why?  Because many developers share this experience and rage against environments that don’t support their desire to work in the zone.

Research backs my experience of hyper-productivity, suggesting that “achieving a flow state is positively correlated with optimal performance in the fields of artistic and scientific creativity” and that “flow is positively correlated with a higher subsequent motivation to perform and to perform well”.  Those seem like good reason to facilitate working in the flow!

What are the distractions?  Open plan offices, interruptions for meetings, talkative colleagues, slow equipment, IM, Twitter, iTunes, email and much more.

What are some other inhibitors?  Working on tasks outside your competence;  lack of confidence in your own ability to tackle a task; lack of a clear direction for work.

Psychologists on The Flow

I wanted to understand the experience better and I found taking a step into the psychology of the flow fascinating and helpful.  The Flow seems a well-studied area and I found that psychology has insights that shed light on this programming experience.

Prof. Mihály Csíkszentmihályi coined the term “the flow”.  From his bio:

Mihály Csíkszentmihályi says creativity is a central source of meaning in our lives. A leading researcher in positive psychology, he has devoted his life to studying what makes people truly happy: “When we are involved in creativity, we feel that we are living more fully than during the rest of life.” He is the architect of the notion of “flow” — the creative moment when a person is completely involved in an activity for its own sake.

I found this video of a speech by Csíkszentmihályi fascinating.  It’s less than 20 minutes long and worth viewing.  (Lack time?  This slideware is similar to the speech but lacks the depth and color.)

In it he talks about his life experiences that brought him first to the field of psychology then to the study of happiness. He explored how poets, composers, mathematicians and others described a state of effortless spontaneous creative flow; hence the flow.

During his speech he quotes an unnamed American composer.  The composer’s words described my experience as a programmer in the zone better than I ever could.

“You are in an ecstatic state to such a point that you feel as though you almost don’t exist. I have experienced this time and again. My hand seems devoid of myself, and I have nothing to do with what is happening. I just sit there watching it in a state of awe and wonderment. And [the music] just flows out of itself.”

Hollywood movies, the source of wisdom and enlightenment for modern mankind, have also explored the effortlessness of The Flow:

Morpheus to Neo in The Matrix: “You’re faster than this. Don’t think you are, know you are. Come on. Stop trying to hit me and hit me.”

Yoda in The Empire Strikes Back: “Try not. Do .. or do not. There is no try.”

… but I diverge.

Can Programming be Ecstasy?

I had never thought of programming in the zone as being in an ecstatic state.  I’d always associated ecstasy with spiritual or drug-induced experiences.  But my experience fits the definition of ecstasy.  Definitions include: “sense of being taken out of one’s normal state”, “trance-like dissociation”, “intense feeling”, “poetic inspiration”.

The Wikipedia definition of Ecstasy (as an emotion):

Ecstasy is a subjective experience of total involvement of the subject, with an object of his or her awareness. Because total involvement with an object of our interest is not our ordinary experience since we are ordinarily aware also of other objects, the ecstasy is an example of altered state of consciousness characterized by diminished awareness of other objects or total lack of the awareness of surroundings and everything around the object. For instance, if one is concentrating on a physical task, then one might cease to be aware of any intellectual thoughts. On the other hand, making a spirit journey in an ecstatic trance involves the cessation of voluntary bodily movement.

This aligned with my personal experience of programming in the zone: total involvement, diminished awareness of surroundings, trance-like, cessation of bodily movement.

As Mihály explains the experience of the composer;

“he achieves ecstasy with only a paper and pencil, … can imagine sounds that never existed before, … [has] an intense experience as if he didn’t exist; his body disappears … his identity disappears from his consciousness”.

To paraphrase as a programmer:

“I experience ecstasy with only a screen and keyboard, I create programming solutions for challenging problems that never existed before. The experience is as if I didn’t exist; my body disappears … my identity disappears from my consciousness.”

The experience of programming in the zone for me was tremendously satisfying, relaxing and (I believe) hyper-productive.  It was not an everyday experience.  It could not be planned or scheduled.  I could not force myself into the state.

The flip side is that once in the zone I was lost to the world — to my wife, my kids, my colleagues, disregarding my appetite and more.  I could easily miss meetings or lunch or dinner or exercise.

Mihály goes on to cite the experiences of the flow from many fields: poets when writing, mathematicians, Einstein when pondering relativity, sportspeople including figure skaters, CEOs and others.

I’m not about to declare programming as a path to enlightenment or spiritual awakening (at least not for myself).  I can’t say whether my experience of programming in the zone is anything like others’ experiences of The Flow or other ecstatic states.  I would like to hear from anybody who has experienced both programming ecstasy and the same state in another sphere of life.  How do they compare?

Still, I do think that the work of Mihály and others can shed light on the programmer’s experience and how to encourage the practical and emotional benefits I found when working in the flow.

Engineering Ecstasy

While I could not plan to work in the zone I think it is possible to create a setting that makes it easier to achieve the state: the engineering of ecstasy.

Sony’s co-founder, Masaru Ibuka, codified its Purposes of Incorporation including the following statement.  [I couldn’t find this at Sony’s site but it is quoted by Mihály and elsewhere on the web; e.g. here.]

“To establish a place of work where engineers can feel the joy of technological innovation, be aware of their mission to society, and work to their heart’s content.”

I think that programming in environments that allow or even encourage programmers to enter The Flow could make the difference between a productive environment and a hyper-productive environment or between satisfying and deeply rewarding.  The hyper-growth of Sony and the select group of recent tech winners (insert your favorite) may in part be due to their ability to create an environment for programmers and other staff.

How does study of The Flow by Mihály and others shed light on programming?  Mihály goes on to discuss “How It Feels to be in the Flow?” and in the process he sets out the precursors and contributors to the flow with all being important.

1. Competence: you must have sufficient skill and experience to tackle the task at hand.

2. Self-confidence: belief in your own ability to perform the task.

3. Direction: a sufficiently defined task and the capacity to navigate towards the end.

4. Ability to concentrate: reduce distractions.

5. Serenity: the absence of worries.

Achieving the flow should not be about perfection of the working environment.  If small distractions affect somebody then perhaps they wouldn’t be able to reach the zone anyway.  If a task is not challenging enough for somebody (their competence exceeds the challenge) then they can still enjoy the task and tackle it effectively with a sense of control.  If, conversely, the challenge somewhat exceeds their competence then it can be a stimulating experience and potentially accelerate learning.

Whatever the circumstance, thinking about these five dimensions is helpful before undertaking major tasks.


Andrew H – Psygrammer

… As an aside: my wife called while I was researching and writing this post.  I had lost a couple of hours in my sense of time.  Perhaps I was in the zone?



27 Comments on “The Flow – Programming in Ecstasy”

  1. […] called it Programming in Ecstasy. Listen to these definitions of Ecstasy: “sense of being taken out of one’s normal state”, […]

  2. […] of the first pieces I wrote in this blog, The Flow – Programming in Ecstasy, explored the factors that help us get into The Zone.  Most writing on this topic emphasizes the […]

  3. […] zone” makes both the tag list and top-10 queries.  The blog on The Flow – Programming in Ecstasy has remained consistently the most viewed post on the […]

  4. Trent says:

    Great article. “Flow” is probably my favorite topic and I have no doubt that everything you said is true. I mainly get “in the zone” while programming or playing Call of Duty (back when I played a lot and was actually good).

    I find caffeine + trance helps me get there (think I saw a study somewhere that said music at a certain bpm helped, but I’m not sure).

  5. vim+terminal help establish flow.

  6. […] longues heures de pratique délibérée afin d’être performant, à savoir: la programmation. Comment être dans la zone lorsque l’on programme est une tout autre histoire et dépasse le cadre de ce […]

  7. Ryan Mac says:

    Dude, you should try programming on acid.

  8. Jeff says:

    Motorcycle Consumer News had a series on ‘flow’ and how to achieve it. One factor I remember was to have stress but not distress. So, you have to have competency (so, no distress), but you need some degree of challenge to create the stress. An example they gave was to time how long it takes you to perform some mechanical task, like changing the oil, and the next time see if you can beat your previous time by, say, one minute.

    Of course, the problem with software development is that — at least in my experience — you’re working with a constantly shifting tool set, or even platforms and languages. It’s rare that I’ve spent enough time repeating similar tasks in a particular area to develop the sort of competency required for flow.

    A great example of a programmer appears to regularly be in a flow state is Notch (Markus Persson), who does webcasts of his coding sessions. He’s been writing games and game engines in Java for so long that he can pump out amazing creations in very short time frames, often against the clock in a coding competition (there’s that stress factor).

  9. It’s very interesting, I have recently been interested in this subject and in how to achieve flow while programming:

  10. WarrenP says:

    The author of “Clean Coding” Bob Martin is terribly confusing on this subject. On the one hand he urges coders not to listen to music, for it disrupts Focus-Mana (WTF!?) but then he thinks that you code badly if you slip into the Zone. So there’s zones, and there’s zones, and I’ve seen ’em all, and baby, there’s good zones and bad zones, and you gotta watch your Focus-Mana…. WTFOMGBBQ!?

    Anyways. Some days are better than others. (U2).


  11. […] this data in mind is highly connected to the “zone”, sought and loved dearly by programmers and other thinkers alike.  To be interrupted is often […]

  12. […] I’m not the only one who feels this way – many other programmers report experiencing the mental state that psychologists refer to as “flow” when they are performing at their […]

  13. […] I wanted to get back to coding, teaching, and writing. A lot has been written about the “flow experience,” where one loses himself in his work. The job of an engineer is loaded with flow experiences […]

  14. Excellent post. I have found moving to a home office has dramatically increased my flow experiences. In addition, I first experienced this sense of flow, not in creative pursuits like programming, but rather in athletics (high-school and to a lesser degree college football, and more recently in taking up golf). In sports, for me, it comes much more naturally and often than in programming, but the experience is the same. The world melts away, time stops, and to use the words of Eric Liddell (Chariot’s of Fire), “I feel God’s pleasure…”

  15. […] Modern offices, with open plan layouts, whilst designed to enhance communication, provide the complete opposite of what is needed to get into the Zone, or Flow as it is known; at least according to Andrew H – Psygrammer. […]

  16. Samuel Sugiarto says:

    Actually i feel this before, i tried to program and a real good feeling coming in, and i can concentrate easy, everything like slowing down, and the world like didn’t exist at all…

    I can get in the zone if i hearing music with my headphone.

  17. […] is useful since you may not necessarily be working at a client site, and once you get ‘in the zone‘ of a programming task, it can be easy to lose track of time, and things like timekeeping […]

  18. […] (In The Zone 或 Flow aka 心流理論) […]

  19. […] Give them a place to work in. A space. With a LAN connection they can use to access the internet and everything they need to access such as file servers, database servers, web servers, etc. This is to achieve what Psychologists calls as ‘The Flow’. You can read an article about this one – The Flow — Programming in Ecstasy by […]

  20. […] all working on the same thing, it’s often relevant, and lot less difficult to get back into the flow state than you’d expect (especially if pair programming).  So the pay-off for developers […]

  21. […] this movie, but for now I’ll just say that to me, it’s the best representation of what the coding “flow” feels like. Here are three other reasons this movie is […]

  22. […] Some people talks about this state as a programmers trance or ecstasy. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s