Owl's Blog on .NET development

Component Owl codes Better ListView control all night so you don't have to.

Are You a Zen Coder or Distraction-Junkie?

What you do when compiling can ruin your life. And not just when compiling, but when waiting for any short computer operation to finish.

That time is ridiculously tiny compared to the rest of your workday, yet it can have a huge impact on your productivity and well-being overall. Yes, that’s a big fat claim.

And by the way, this article is not just about coders or programmers. It’s about any smart people working with computers. And there will be pictures! Let’s rock and roll –

Why am I writing this

I recently started implementing certain time management techniques into my work style to boost my productivity, reduce stress, and help my body and brain rest. I basically wanted to work in uninterruptable 100% focused 60-120 minutes blocks of time, followed by a 20-30 minute breaks.

However, I almost immediately run into a big problem: When I was compiling or deploying something, I automatically opened one or more of the following: Email client, Facebook, news reader, news sites. That’s a bad habit. It’s hard to break. It ruins my goal of clean focus.

So I decided to do some research. There was a discussion on “What to do while compiling?” on StackExchange. The most up-voted answers were of the “reduce the compilation time” kind. However, these answers don’t solve the more general problem: There will always be waiting times while working on the computer.

Other than that, the people in the discussion were mostly suggesting what they usually do (such as checking email or news) – which is a horrible idea. One good advice was that “Multi-tasking is bad”. I agree with that. But overall? Not. Good. Enough. The answers were disappointing. So, in this article, I am going to explore this issue deeply and present you with the optimal approach.

Two kinds of coders

There are two extreme archetypes of coders – The “zen coder”, and the “distraction junkie coder”. Both are extreme, so both should be rare on the bell curve of distribution, right?

Wrong. Although the “Distraction junkie coder” is, in fact, extreme, he is unbelievably prevalent.

A picture is worth 1000 words, so I am going to show you, with pictures, what is happening on the mental desktops of both of these kinds of coders.

The zen coder

What does zen coder do?

He codes. That’s the only thing he does, and that tells it all. Perhaps the more important question is what he does not do: He does not succumb to distractions. Clean focus. Clean cuts. Clean coding. 60-120 minutes of pure coding, then a 20-30 minute break, which is usually off the computer. Then he codes again. (The minutes are just an example. He can use a different pattern – but he is always balanced and betting on the long-term productivity.)

His mind is like calm fluid water with a steady flow. It is not like frozen water shattered to 1000 constantly shaking pieces.

This is how the mental desktop of zen coder looks like:

Zen coder's mental desktop

The distraction junkie coder

Even if your mental desktop looks like the one of a zen coder, just a few minutes after you open Facebook and check your email – e.g. when compiling, it will look like this:

Distraction junkie coder mental desktop

And that is, ladies and gentlemen, after just merely checking your email and opening Facebook! If you also have a bunch of real-time notifications, IMs, and check your RSS and twitter, the above will look like a scheme of a meditating monk’s brain compared to the havoc you will break.

You will probably never fully recover from that. Not on that particular day, anyway. Even if you minimize all this crap on your mental desktop to your mental taskbar, it will remain there, tempt you forever, and eat up your mental resources. And boy, the time will fly by, and you will wonder where it went.

Oh, and by the way, if you are distraction junkie, then you must check out our web comics for developers! Don’t even return to finish reading this article. And don’t forget to subscribe to the comics RSS! And read all the strips! Then send it to your buddy, and start chatting! The distraction-rabbit holes are not that deep, really!

The difference between zen coder and distraction junkie coder

Zen coder prefers long-term happiness and productivity. He is capable of focusing deeply. He trains focus.

Distraction junkie coder prefers instant gratification for the price of not reaching his full potential and hurting himself both physically and mentally in the long run. He is too lazy to focus.

To fully grasp this, we first need to understand how our brains work.

How our brains work

The truth is that we don’t really know, yet. But, based on our current understanding, there are some useful analogies that psychologists have been putting to a good use for some time, and that can help us grasp some of the complexities.

The computer analogy

Your brain is a computer. Sure, it is infinitely more complex than a PC, but the computer metaphor allows us to describe many processes that are going on in the brain. There is something like HDD, there is something like RAM, CPU, there are processes and threads, and it takes certain amount of time to access information and to calculate things.

It is obvious that our brain has only a certain capacity to focus at any particular moment. You can focus on 1 thing well, or on 3 things badly, but you can’t do both. Even switching from one task to another carries a cognitive cost, especially if the tasks are in different contexts.

Once you bring something to your awareness, it takes time to fully dispose of it and its associated resources and to purge it from your mental RAM and background processes. It can even take hours or days. Things recently brought to your awareness constantly re-appear at random moments. Even if you do not notice them floating in your mind, they are there – and they take up resources, and reduce your ability to focus.

The chest of drawers analogy

Another useful metaphor is a chest of drawers. Your brain stores stuff in drawers. Each drawer is a cloud of data associated and linked together based on certain contexts and concepts. At any particular time, some of the drawers are open, and some closed. The open drawers represent your current mental landscape, the stuff that is easily accessible.

The big problem is that it takes time to close mental drawers, but opening them is instant.

So, when you are working, and then switch to some news site, it can instantly open a bunch of drawers. When you return to work, these drawers will remain open. The only benefit is it can help you with creativity and brainstorming – but unnecessarily opened drawers come at a cost. They reduce your left-brain raw mental power and ability to focus.

What to do while compiling?

What you do when waiting for some computer operation to execute can determine if you are a zen coder, or distraction junkie coder.

The main idea here is to:

  1. Not lose focus, and
  2. Take a micro break.

Not losing focus is not that hard – all you have to do is to switch your brain off, or keep thinking about your code. However, switching off is better. It’s a micro-meditation, and it also serves our goal of taking a micro-break.

Why meditation? Well, your brain is crunching code all day, so why not give it a rest? Plus it’s scientifically proven that meditation leads to permanent increase in levels happiness. Just imagine the long term benefits of this seemingly trivial habit of meditating for 30-60 seconds couple of times per day.

Now, what to do on your micro-break? Do any of the following, combine as you wish. You can also do them all, in this order, depending (or not) on how long is the operation taking.

  1. Get up
  2. Look into distance
  3. Put your hands behind your head and lean back on your chair
  4. Stretch your legs, then raise your hands as high as possible
  5. Close your eyes
  6. Gently massage your eyes
  7. Slowly turn your head to the right, left, up and down as far as possible
  8. Close your eyes and breathe
  9. Go get a glass of water (Be careful not to get distracted by your co-workers on your way.)

You can do also anything else that engages primarily your body and not mind – isometrics exercise, juggling, sword-fighting ;-).

And by the way – if your boss gives you hard time about any of this, then refer him to this article. It is far better for you to quickly rejuvenate yourself and maintain focus than to appear working and get distracted, lose focus and become tired sooner.

Stretching can be very beneficial. My physiotherapist discovered a lot of tension in my shoulders on my last visit. She told me that it’s there probably because I have my hands bent all the time when siting at the computer, so the muscles shorten and work uneconomically. The best thing I can do? Lift and move my hands, try to reach as high as possible. That’s now one of the things I do when compiling or waiting for a computer operation to execute.

You’ve probably heard that it is a good idea to stretch and take a short break regularly when working on the computer. The problem is the implementation – even if you set a timer, what if you are in a middle of a difficult problem when it goes off? It’s just seems impossible to implement. However, if you take the micro-break while compiling, it works great and you can even make a habit out of it, so it gets “automated”! The compilation now becomes your reminder to stretch. Incredibly powerful stuff.

The things you shouldn’t do when compiling

I really want to hammer my point home, so just to make things absolutely clear, here is a list of what you should NOT do when compiling. Think of it this way: These things will not just ruin your focus, but you will deprive your mind and body of the micro-break.

  1. Check your RSS
  2. Check news (any news)
  3. Check email
  4. Check social media (Facebook, twitter, G+, LinkedIn, reddit – you name it)
  5. Watch videos

Doing the following 2 things is better than all of the above, but it is still not optimal:

  1. Chat with a co-worker
  2. Read a physical book

Clean Focus and Clean Cuts

I will close this article with what I think is the ideal approach to daily work-flow – the zen coder way.

The key to true productivity and efficiency is to focus 100% on the one thing you are doing at the moment, and then to completely switch and do something else. There shouldn’t be any blurry transitions from one thing to the next.

Divide your time into 60 – 120 minutes blocks of work. Focus 100% percent in these blocks of time. Then take a 20-30 minute break and do something else entirely. You can check your email and social media during the break, sure, but a brisk walk or a short nap and healthy snack will do you more good. After the break is over, check what’s next in your task management software (e.g. I use my own Swift To-Do List), and do another block of focused work. It is somewhat similar to Pomodoro technique, only on a larger scale.

The breaks are not optional. Don’t even think about skipping them. Your body needs them. Take the breaks even if you do what you love – in such a case, you will be motivated to accomplish more in the next time block.

Your work-flow should look something like this:

(Task 1 – Task 2) – Break – (Task 2 – Task 3 – Task 4) – Break – (Another 60-120 minute block of tasks) – Break…

And not something completely chaotic, random and sad, like this:

Task 1 – Email – Task 1 – Facebook – Task 1 – Task 2 – Minibreak – Facebook – Task 2 – Email – reddit – Task 3 – Email – Break – Task 2 – Email – Task 3 – twitter – Hacker News – twitter – Task 1 – Task 3 – Break – Task 4

If your workflow is sub-optimal like that, you will neither fully relax nor accomplish what you could. This is inferior on every level. It is not just a waste of your potential and time, but often also completely unnecessary wreckage of your body in the long run.

I won’t lie to you. Focusing is really hard. It’s hard, because when you are not doing it, you are basically training the opposite. Habits and ingrained routines are inherently hard to change.

The good news is you can train. You can learn to focus. It’s a learnable skill for everyone, and incredibly well worth the effort.

– By , the obsessed author of task management software for Windows. He is posting this guest article here on ComponentOwl.com, because his Swift To-Do List uses .NET Better ListView from Component Owl as its core component.

PS: Know anyone who is checking email 50 times a day, and has 12 different notifications jumping in his face all the time? Send him this article. He will thank you later.

55 Responses to “Are You a Zen Coder or Distraction-Junkie?”

  1. Great article. I agree with the premise. On the solution side, I find pair programming the single most effective technique to avoid distraction junkie behavior. After all who wants to be seen browse the news or update Facebook by their colleague? And during small waits, just talk with your pair as to what to do next, how to refactor the code, get up and stretch, get a cup of tea, etc.

    • Agreed. I just joined a team after years of training/coaching. Working in pairs make focus so much easier. Also, one computer and two people make it harder to do the social media thing. Recently, my pair partner and I (the partner changes) frequently look at side stuff around our project during a build (with unit tests and functional tests running). This kind of focus is fun for me. It does make it easy for me to not even want to use a computer when I get home in the evening… at least some days.

  2. Kyle Ellingworth says:

    Jiri. I first off want to say that I believe what you’ve written to be correct, or at least careful in tentatively stating things you haven’t confirmed as fact. I also believe it to be immensely useful to people chronically suck in their own self-harming cycles, be it distraction or demotivation or anxieties.

    I want to criticize you in how you go about meeting your goals. I should let you know that I’m operating on a few assumptions. The first is that a normal rational human being is skeptical to new information they find. The second is that normal rational human beings reject things which they cannot confirm to a critical threshold. The third is that, when it comes to their own minds, the skepticism is increased at least ten-fold.

    Your presentation meets exactly that failure. You present your methodologies in a clear, accessible way, to people who have no reason to trust you. The information is narrow in scope, and largely consists of abstractions of an inner cognitive model you have, and how new techniques relate to your model. As this is all new information to your reader, the amount of points a reader can identify with are limited. The number of reassuring moments of agreement, where you say something the reader already knew themselves, is limited. Thus, the user faces sustained unverified facts, and their skepticism gets more and more impatient. I’d reckon most readers wouldn’t even make it through the article without dismissing you as yet another useless writer who thinks they’ve figured out the world.

    “all you have to do is to switch your brain off” is extremely vague and meaningless language, despite knowing all of the things I know now, I have yet to achieve such a thing. In fact, the entire meditation connection was weak, because you claim benefits, but never tie it into the original point. “He is too lazy to focus.” is not only a potential insight to your self-confident reader, but also a reassurance that people are who we are, and cannot change. People aren’t lazy, they just sometimes get stuck in loops which diverge them from reaching their goals, or their goals are misaligned with their objects, or a number of other temporary transient reasons.

    Sorry, I’ve written a lot and I don’t feel like continuing. If you’ve read through this post completely dismissive of my points, then at least take the time to analyze which thoughts lead to your dismissals, and where those thoughts came from and shall lead…

    • Jiri Novotny says:

      Hi Kyle,

      Thanks for your comments.

      What I’ve written works for me. It has taken me many years of trial-and-error to discover this approach. I also know it works for others – but that’s just anecdotal evidence, and every human being is a bit different.

      The best way to verify if something works for me is to simply try it, and I think that’s valid approach for most. If what I wrote makes sense to someone, he can just try it.

      But you are, of course, right – I could’ve been much more convincing. I will definitely work on that, as I always want to hone my skills as a writer.

      Have a wonderful day, Kyle, and once again, thanks for writing.

      • Nish says:

        Well said, to both of you. Finally, evidence that mature, stimulating, respectful & thought provoking debate can occur in web comments!

      • Ivan says:

        For what is work Jiri, I don’t know anything about you at all. But I do have a brain and can reason things, so I don’t need to trust you to be able to learn from what you wrote :)

        It really drove a point home, and I thank you for the lots of productivity I’m about to start gaining.

        Tabs BE-GONE!

        Also, I’ve wanted to gain some fitness for a long time now, so I’m gonna start doing some push-ups during my micro-breaks, and perhaps do a run during a larger break, so my body thanks you too :)

  3. G says:

    The distraction junkie thinks outside the box and may well come up with better solutions.

    The “zoned-out” coder, is boxed in.

    • Jiri Novotny says:

      There is no question that outside inputs can be beneficial for creativity. The problem lies in when these outside inputs are consumed.

      • sigs says:

        It’s a balancing act. Also, multitasking is a very personal thing. I might be your distraction junkie coder; and sometimes I really wish I could pull myself together more forcefully and just Get Shit Done 100% of some time interval…

        alas, that’s not how it goes. If I want, I can focus, but the result isn’t much better. I might get trapped in a loop of not finding the (later) obvious solution and just walk in circles. That’s no fun either.

        On the other hand, I often notice that after a break – be it walking a round or opening facebook, reading the updates and then closing it – my brain has done the work for me. I think of it as distancing and returning. Work on it and push it as far as it goes; when it gets stuck, take some distance, return and see if it looks different now.

        Obviously if it’s badly stuck (for, say, days) I get frustrated and blame it on distractions and my inability to focus. But at the same time, I know I’m not just turning a crank. I mean, 95% of the time I am, obviously, but the remaining 5% is the art and the craft, the part that justifies them having me doing it and not the 18-year-old fresh off high school.

        My two cents.

  4. Orgil says:

    Why did you spend so much time to write this article if you are zen coder?
    i agree with you if you are zen blogger writing about the coding :)

    btw, i like your pictures how you depict mental metaphor

    • Jiri Novotny says:

      There is nothing wrong doing 2 or more different things. I’m not trying to imply that at all.

      Wrong is if you try to do them all at once.

      (And by the way, this post is my weekend and after-work project.)

  5. Jad Jabbour says:

    Hey, nice article, interesting theory but i beg to differ and i will do so by giving 2 examples.

    my theory: It differs from one person to the other, and multi-tasking can be a good thing.

    1- Albert Einstein came up with his best theories while he was working at the post office a rote, boring monotonous job ( like checking your feeds, which has become natural to us ).

    2- I do have , as a coder, time management problems but the problem is not that, i work best when i am multitasking and i solve problems faster than when i am fully focused ( i;ve experimented ) but i have found that the main reason i have time management problems is because we developers lose interest when we are in code-monkey mode, there are no solutions to think of, we already solved it, we have our flow charts and UMLs and are simply coding away, it’s boring REALLY REALLY BORING and uninteresting. As soon as i face a bug/error my brain kicks into overdrive. also the closer i am to the deadline the more my brain is in overdrive.

    there might be some truth to what you wrote but i do believe it differs from one person to the other.
    anyone else feels this way ?

    • Jiri Novotny says:

      Hi Jad,

      1) I also get my absolutely best ideas when in the shower, or on my way to work, or when cooking. But that is not in conflict with what I wrote at all.

      Imagine Albert Einstein writing some theory on a blackboard, and constantly checking his twitter and email. That’s the problem. Not doing something else and letting your subconscious mind work.

      2) In this case, Pomodoro and other anti-procrastination techniques help. In my case, I just launch some upbeat music and code away. It is actually a quite joyful experience.

  6. Cristobal says:

    Nice article!. I’m definitly a Distraction-Junkie one. I’m taking your article like a “from Distraction-Junkie to Zen-Coder” guide ;).
    Thanks.

  7. sissi says:

    it is hard to get into that “flow” of coding anyways in many workplaces. quite often there are like five managers for two coders and you constantly have someone approaching your desk or waffling nearby. on the other hand when it’s too quiet it is kind of awkward too so I prefer very much to code locked away on my own.

    the only problem is that when coding alone i feel constantly hungry and eat all the time :-D

    it also helps to physically power yourself out before you code as otherwise your body gets in the way and you want to move and do physical stuff rather than sit and focus. some physically demanding yoga practise like ashtanga or vinyassa is good as it gives your body the workout he needs and prepares/focuses your mind.

    being focused needs to be practised every day all the time. so reading an article or book without the mind wandering off or listening to another person talking without thinking of your to-do-list needs to be practised constantly otherwise your attention span will get shorter and shorter.

    i read a quote of some zen master once that goes something like this and sums the issue up nicely. the master was talking to a student who was complaining about that meditation is boring (i think): “you lie but you’re sitting already. you sit but you’re standing already. you stand but you’re walking already. when I lie I am lying. when I sit I am sitting. when I stand I am standing and when I walk I am walking.”

  8. Bipin says:

    Nice article.Ran into this while i was programming :D

  9. Timon Vonk says:

    Great article! I would even go so far as stating that the main thing differentiating great and average programmers is just this; getting the flow right to supercharge productivity.

    As a CTO, I code only part time, and sometimes not at all. However, that does imply that the time I do spend coding, has to be as effective as possible. I recently started experimenting with morning workouts — quick and timed — giving me huge amounts of energy for the rest of the day. Also, adrenaline helps you focus. Secondly, for timeslots I prefer the pomodoro technique. Macs have some great tools for this. The thirty minute slots with a timer force you to concentrate. Stating what you are going to do for the next slot commits your mind and _really_ helps you to maintain focus. Combined with planning your day every morning and saying to yourself: “This is what I’m going to finish”, is has awesome effects.

    Finally, no notifications. Not for mail, skype, twitter, adium or IRC. If its important, people should call, else they’d have to wait a while. Not even highlighted icons.

  10. very good point for productivity and time management. You should write more about this topic, maybe a being zen coder guide :) thank you.

  11. Daniele says:

    i just read this while a clean and build, no joking….

  12. Jeff says:

    I find that depression begets distraction-junkie behavior, which begets further depression.

    To sit at a computer all day and be happy requires that one regularly reach ‘the zone’. In order to reach this state, one must have significant mastery of his or her domain. Constantly having to decipher terrible documentation and work in a hideous or convoluted codebase inhibits this. After enough resultant distress and little sense of mastery, a person loses interest and begins to search for the brief doses of accomplishment and satisfaction from other sources.

    The next time you stall out on a difficult or irritating problem, do you Alt-Tab to [favorite social bookmarking site]? If so, you’re substituting momentary distraction and discovery for real accomplishment, to the detriment of both.

    If you find yourself unable to break this cycle, consider whether you may have fallen into depression.

  13. Raphael says:

    I feel your pain. I could never go back to the old ways of developing in java or .net when programming finally reached a point where the developer productivity and conformt is more important that over engineered, over complicated, over bloated architectures.

    Simplicity is a great asset towards reaching zero turn-around.

  14. Dave East says:

    You just listed ALL of those things I do on a microbreak! (the good ones, not the bad ones :P)

  15. alex says:

    I would say chatting with a coworker is even worse than a computer-related distraction. If you’re checking your RSS and see that the compiler is done, you can close it and run the program. If you’re chatting with a person and the compilation finishes, there’s typically a social taboo against just turning your back on them.

  16. Just wondering, if listening to music while coding causes any distraction?

    • Jiri Novotny says:

      The research mentioned in “Peopleware” book suggests that listening to music counter-intuitively reduces your creative abilities. The music engages (and “occupies”) the right-part of your brain, which is used for creative tasks. On the other hand, music helps you to stay in the flow, and can help with the left-brain tasks.

      My rule of thumb would be to listen to music only when doing routine stuff/work where you don’t need to think much, and use silence or white-noise when working on creative or difficult tasks. If your environment is noisy, you can also consider noise-cancelling headphones – the added benefit is that people will be less likely to disturb you.

      • alex says:

        “The music engages (and “occupies”) the right-part of your brain, which is used for creative tasks.”

        Right.

        “On the other hand, music helps you to stay in the flow, and can help with the left-brain tasks.”

        Wait, this is the opposite of what you just said. I don’t remember this part in Peopleware.

        • Jiri Novotny says:

          Peopleware (Second edition) talks about music & productivity in the chapter Bring Back the Door, page 78.

          But you are right, that part with staying in the flow was not in Peopleware. That’s just my observation.

          Peopleware is highly critical of listening to music while working.

          It also says: “As any kid who does his arithmetic homework with the music on knows, the part of the brain required for arithmetic and related logic is unbothered by music – there’s another brain center that listens to music.”

          It all depends on the situation. For example, factory workers have better productivity when music is playing. That’s why I was saying it’s good for staying in the flow – however, that was a very unfortunate expression. What I really meant is that it’s good for routine stuff, including administrative tasks and mindless implementation where thinking is not needed. For me, music can produce euphoria while doing these otherwise mindless tasks. I can then turn it off and proceed with the regular tasks where creativity is certainly a huge benefit.

          This is a good resource if you want to discover more about the relationship and productivity:

          http://www.workplacedoctors.com/wpdocs/qdetail.asp?id=1297

          The results of studies done to this day are mixed. IIRC, I’ve seen one study that claimed students taking a math test performed better when listening to classical music during the test. But, there are also several other studies that show different results.

  17. Mr.excepter says:

    wow,zen coder,awesome!!!
    I used be a Distraction-Junkie coder,and I have found the same way to make my work more Efficiently.
    but I want to konw that if there are some exceptions in other business need Distraction-Junkie,maybe we can
    settle this Contradiction.

  18. Luigi says:

    Very intresting… But if I was not a distractionjunkie developer, I never found this article. :)

  19. anon says:

    reached this article during one such regular distraction for HN. so not entirely wasted. but i haven’t started working on my million dollar idea, so sadly very true. bookmarking it! and blocking hn, reddit… in hosts file.

  20. Juanjo says:

    It’s absolutely true, but done that I can’t always be a zen coder I try to have distractions after the code compiles so that I am bored of distractions while it compiles and still can have errors. I admit neither it works too well …
    I think the solution could be to write news insulting us for being lazy, and so we would get motivation to continue working.

  21. CharlieBear says:

    Bulls-eye! Some really good tweeking ideas for design and coding issues have come with eyes closed while waiting on a compile or upload. I not a Zen developer yet but will work on your idea and see if I can get to the next level with less STRESS! You are 100% correct about the downside of being a distraction junkie. Thanks for a great article!

  22. Ryan says:

    Very interesting article, and I mostly agree with all of it. Multitasking can be dangerous and distracting, however, where I work, my communication with different departments is critical, so I can’t go not-checking-my-email for three hours. I definitely do things like check my email, maybe chat, during build time. These things are so quick I can stop immediately and go back to working. I do however avoid things like facebook/reddit/slashdot, because those are less likely the engagements I can quickly drop as soon as my build is done. Just my two cents, some people might have more self control over others when it comes to getting back to work.
    Also, I find I’m most productive when I have a more-than-full pipeline (i.e, many more tasks to work on with little time to do them all)

  23. Douglas says:

    I actually really enjoyed this article and will be sharing with a lot of people. I must say that I struggle with this exact problem of checking dev blogs and social feeds of developers while waiting for cpu operations. The developer subject almost allows me to rationalize the time I’m wasting because its code related and I learn from it, but I should be doing this during long breaks or before/after work because it can take me a long time to get back to focus. Thanks for sharing this information and I look forward to attempting to implement this right away.

  24. Dan Sutton says:

    I think I’m both types: it depends on how hard a problem I’m trying to solve. If I’m writing a compiler, as I was last week, then there’s virtually no distraction at all; if it’s website stuff, then Facebook sees quite a bit of me. There’s a boredom quotient here, too… the harder stuff is more interesting and thus I’m going to be less apt to be sucked into doing something else on days when I really have to think. As you can probably tell, today is not one of those days…

  25. Carlos López says:

    How bad it is that i read this whole article on one of my compiling breaks??

    Jajajaja, i’m not a Zen coders, i do in fact, do some relaxations, chat a little with co-workers, check internet stuff.

    Most of the time, i’m breaking bugs of stuff i coded. Depends on what i’m doing its how i work. If its something urgent or something pretty interesting, times goes flying, if its some addition of thing already working or breaking bugs, then break present a lot!

  26. pat says:

    I think you’re underestimating the importance of compilation time, or how broad the spectrum of compilation times can be. Sure, there will always be cases where you need to wait on your computer, but for a programmer, if you can eliminate the compilation penalty, you can eliminate 99% of the opportunities for self-distraction.

    For one project I’m working on, “A”, it takes 2 minutes to do a build, even when nothing has changed. Another project I’m working on, “B”, uses a compiler that only needs to compile the one function that changed (in memory, i.e., it doesn’t even need to load a whole text file from disk), and never takes even as much as 0.1 sec.

    For project “A”, if I adopted this “zen” approach, I would spend the vast majority of my day simply staring out the window. So I have to try to multitask, on other aspects of the project, admittedly poorly. For project “B”, I simply can’t get distracted long enough to go to some social media site, even if I wanted to. I only know the compiler took a whole 0.04s because it told me.

    There is a social problem here, yes, but it’s caused by a technical one. Have you ever used a service that took 2 minutes to log in? (I have! If you were on the internet back before modems even had a “K” in their speed, you probably have, too.) There’s a huge usability difference between a slow service, and something like Facebook which is essentially instant-on. One truth of technology is that a big enough quantitative difference leads to a qualitative difference.

    Why is it even possible for some compilers to be so slow still? They’re not doing *that* much work. My version control software (hg inotify) knows instantly whether any files have changed, and doesn’t need to walk a bunch of folders to check timestamps to find that out. Why isn’t my compiler that smart? I’ve got gobs of extra memory and CPU to spare. It shouldn’t sit around doing nothing at all, and then spring into action when I run the “build” command and start up a bunch of new processes, and load a bunch of files, and feed them through the lexer and parser and so on. It could have been doing the first 98% of this while I was typing, and it was sitting idle.

    There’s nothing special about compilation, except that we do it a lot. If your text editor if it took 2 minutes to save a file, would you say “There will always be waiting times while working on the computer” and analyze the effects of visiting Facebook, or would you find a way to switch editors? On project “B”, I can’t remember the last time I had to wait on my computer for anything.

  27. Christian says:

    Hi,

    nice post. I wrote a similar before over a week. I called it:
    “The 10 Rules of a Zen programmer”
    http://www.grobmeier.de/the-10-rules-of-a-zen-programmer-03022012.html

    Basically you are going into detail with my first rule of Zen Programming: focus. What I like is the idea of micro breaks. The images are great.

    Anyway, I think “focus” only does not make you a Zen programmer alone. The article does not show about your relation to Zen, so I think you used this term to emphasize the “reduced” distraction noise around you.

    However, a good article.

    Cheers

  28. dario-g says:

    Great article but fast CPU, plenty of RAM and SSD will help you ;) Like helped me :)

  29. Bob says:

    Lucky for the author I’m a distraction junkie or I would have never read this article.

  30. Emanuel Landeholm says:

    +1

    Back in my C programming days of computing youth I used to do a lot of juggling. Looking back, I now realize that I was really on to something back then. But in a completely oblivious way! I should probably pick up a new set of juggling balls… Then again, perhaps not. I don’t want to distract my co-workers unnecessarily.

    • Jiri Novotny says:

      Juggling is awesome! One of my friends in the office juggles too. It’s not annoying me at all.

      Or, you can juggle in a different room. If you get a desk close to the door, you can leave/enter the room unnoticed.

  31. Carl says:

    Interesting article. Since starting regular (1-2 hours daily) meditation a couple of years ago my working day has naturally, without any effort on my part, started to follow roughly the pattern suggested in this article. I’ve also stopped looking for distractions during compilations (again, it’s just happened almost on its own).

    I can also confirm that the benefits to my productivity have been significant.

    Cheers,
    Carl

  32. Awesome post, I can’t stress enough how important it is not to lose focus

  33. minime says:

    What you forgot is all the external distractions, like phone calls, coworkers coming in, or system surveillance alarms…

  34. Jiri Novotny says:

    My latest post about Hidden Procrastination:

    http://www.dextronet.com/blog/2012/02/hidden-procrastination/

  35. Umair Jabbar says:

    Very nicely written.

    I am glad that my natural habit of stretching more than once on a day at work is not something that I should try and suppress :)

  36. […] Are you a Zen coder or a distraction junkie? It’s been a while since I’ve worked on a project where “my code’s been compiling” has been a valid excuse for not working. But now that I am on such a project, it’s important that those mini-breaks don’t turn into longer breaks. […]

  37. bluszcz says:

    “””PS: Know anyone who is checking email 50 times a day, and has 12 different notifications jumping in his face all the time? Send him this article. He will thank you later.”””

    I knew. And I sent it to this person. It was my boss. He said thank you and fired me.

    ;)

  38. Amir says:

    “However, I almost immediately run into a big problem: When I was compiling or deploying something, I automatically opened one or more of the following: Email client, Facebook, news reader, news sites. That’s a bad habit. It’s hard to break. It ruins my goal of clean focus.”
    This is how I got to your article!!! Some nice things grow from bad habits

  39. Himanshu Mishra says:

    Great article ! …. thanks :)

  40. Foobar says:

    and average managers always value distraction junkie coder higher than zen coder, because first one multitasks and is more social [and is always first to blame others]

  41. […] of a syllabus and the curriculum. I started working on them after the lecture. I had fun coding in zen mode for some time, going through the course material on my own pace and doing the quizzes and […]

Leave a Reply to Jiri Novotny