
Are You a Zen Coder or Distraction-Junkie? - jirinovotny
http://www.componentowl.com/blog/2012/02/zen-coder-vs-distraction-junkie/
======
dkarl
I've had a lot of different work habits over my career, mostly because of
internal psychological factors and external work circumstances. What I've
learned from all the variation is that when I encounter a moment of
uncertainty and doubt, my brain wants to decide between two choices:

\- relaxing and taking a web-surfing break (Facebook, HN, national news) until
the uncertainty resolves, or

\- gritting my teeth, amping up the intensity, and blasting through to the
right resolution while heavy metal music wails in the background.

I think this is because I can't face the possibility that I'm actually having
trouble. Programming is easy! I'm smart! I have to be, because I'm not good-
looking enough to get away with being a moron who doesn't always know what to
do next, who actually has to think when he writes code. What's the point of
being alive if you have to be someone like that, both ugly and stupid?

Yes, my brain thinks a lot of strange and stupid things when I'm not paying
attention and correcting it.

Neither of the choices that my brain sees as exhaustive alternatives is
correct. The best thing to do is relax, tell myself that programming is
sometimes hard and it's okay if I need a few minutes to figure things out, and
keep working on the problem even though I'm confused. For most of my life I
had to be either unusually excited and happy or under some kind of threat,
such as a deadline or an upcoming test, before I could bring myself to
concentrate on a task that I didn't find easy. Now I do it every day.

What's interesting is that the techniques I use to calm down my mind while
it's freaking out over the uncertainty are exactly the techniques I use to
keep my mind calm while I meditate: posture, breathing, awareness of body
tension, and awareness of my mental states. I also analyze my thoughts and
feelings just like I do in insight meditation. Zen coding, indeed!

~~~
nosignal
Interesting you mention this; I've recently started a new job which requires
me to learn a whole new skillset (web programming with JavaScript). I've been
a developer of desktop apps for a while so programming isn't new, but the
language and the paradigms (async? wtf?) are challenging. This is in contrast
to my early memories of "web programming" aka making a static Geocities site
with notepad and wondering why everyone was so excited about the web when it
was this easy to make a web page... turns out it's not that easy anymore.

The point being that it really is in those moments of confusion and
frustration - where you try something and it doesn't work, or you realise you
don't understand how to do what you want to do, _especially_ when you think
what you're doing is supposed to be easy - where distraction comes in and you
go off track.

I've managed to realise that and am glad I'm not alone. The next step -
actually doing something about it - is a little harder (hence why I'm on HN
right now...!).

~~~
MaxGabriel
I had that realization today, that I was getting frustrated too easily when I
had to learn something new and difficult in iOS, and inevitably I'd bring up
Chrome to load HN & co.

This morning I followed the workflow in the OP, and it really improved my
performance. I set a timer for an hour, really put work into understanding
everything, and when I was done I took a 35 minute break (it is a Sunday). It
was rewarding and productive; I'm going to keep this behavior up. Thanks Jiri

~~~
vectorjohn
I know it sounds silly, and I joked about it for a while before trying it. I
put HN, reddit, and news.google.com in my hosts file pointing to localhost.
The extra few seconds it would take me to modify that file, and the knowledge
that I was breaking something I explicitly put up for my own good, keeps me
from visiting these sites.

On the other hand, I've learned a lot of new distracting sites this way :(

------
greenyoda
"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."

This might be usable advice for someone who works at home on his own business,
but for those of us who work in office environments, there are sources of
distraction that are much more difficult to control than the urge to read
news: meetings, your boss walking into your office, colleagues who interrupt
you with urgent requests for help, etc. (If you're a developer who also
manages a team, multiply this by ten.) The only time I can get an hour of
uninterrupted work is after everyone goes home. So I think a more useful
question is: how can you get back into a productive state more quickly after
the inevitable interruption occurs?

Or, to go back to Zen: how can you lose the attachment you have to the flow of
uninterrupted work? When it happens, it feels really good, but when it doesn't
happen, it would be better not to get too frustrated about it and be able to
move on.

That said, I thought the article's advice to consciously choose stretching or
brief meditation over e-mail or news to be something worth trying.

~~~
beza1e1
In a larger office, you are usually not paid for being productive. Responding
quickly to mails from your boss is probably more effective than focused
coding. So don't worry that much.

For the occasional productivity burst: schedule yourself a fake meeting, pick
a lonesome place and your laptop, disconnect from instant messengers etc.

~~~
nlawalker
Bingo. The problem of office interruptions reduces down to priorities and
having a boss that understands your work.

Interruptions don't have to be inevitable - there is almost always _something_
you can do to cut yourself off. For me, I could book myself solo into a
conference room for 90 minutes, block the time on my calendar, turn off my IM
and mail toast, put earphones in and _work_.

If the concern is that you can't do this - that you'll get in trouble or won't
be meeting expectations - either your priorities are out of order relative to
what your boss/organization thinks they should be, or your boss/organization
isn't convinced that cutting yourself off to do solitary work adds any value.
One could argue that a really good boss would understand it already, but we
don't always get really good bosses - if your boss isn't already convinced and
you don't want to do the work to convince them, I suppose the answer is to
either put up with it or leave.

------
lysol
There are salient points here, but they're masked by the caricature of a
maniac who can't go without Facebook for five seconds and a mythical beast
that never gives his brain a break from work. Real developers fit into some
reasonable amount of both kinds of behavior and it's the balance that is
important, and different for every developer.

Be smart and be true to yourself, not a watered down version of someone else's
life philosophy.

~~~
steve8918
I agree. I don't like it when some random blogger talks with fake authority on
an issue and boils it down to some black-and-white binary comparison.

That being said, one thing I realized last week is that I distract myself way
too much while I'm supposed to be working. Starting tomorrow (I don't plan on
working today), I'm closing my e-mail, IM, Facebook, Words with Friends and
stock charts and hope that increases my overall productivity, which has been
extremely, extremely poor over the last 6 weeks.

~~~
indubitably
> Starting tomorrow

No you're not. I mean, come on. This guy is advocating an asocial lifestyle.
We live in our computational environments, and we need constant contact with
the world outside that environment, even though we're _using_ that environment
to make the contact.

We're human beings, not machines.

~~~
jgeerts
That's what I thought too, not talking to your co-workers is a bridge too far
and the consequence for doing the meditation is that everybody in your company
will know you. But there is a lot of truth to what he is saying and I often
find myself in the distraction loop he is describing. If you plan out your day
more structured you will get more result, I agree on that. He is also
describing what our bosses expect from us, writing code most of the time. But
we often read HN, facebook, twitter... We need breaks but I indeed handle them
unstructured. I will take some, but not all of his advice.

------
chrislomax
This is the first news story I have bookmarked, ever. Mainly because I got
distracted and started reading Mashable.

Jokes aside, I thought I had a form of ADHD with how much distractions
distracted me. It's quite comforting to know other people operate this way.

I have recently, as kind of a new years resolution, aimed to be more
productive. I have found myself managing my project management list more
efficiently and using my "priority" status on my tasks. When I get in, in the
morning, I just work top down on my priority list.

My main issue was down to not knowing fully what my next task was so I would
spend time finding the task that needs sorting. I have found that the extra 15
mins a day I spend updating my task list has saved hours per week.

This has also helped when you get to the end of projects and you get the small
tasks that can take hours to sort when there is no clear defined list.

I'm a task completion junkie, I feel good when I mark a task 100% and the
changes I have made so far this year have fuelled my addiction.

~~~
tathagatadg
Hehe, wish I read your comment before posting mine. But I tried this path
(after seeing Randy Pausch's talk on time management) and soon discovered it
was hurting my brain to decide how should I assign the correct priority value
to a task. How do I decide if this homework should be assigned 4 or 5 and the
other 6 - Should I try to just make it a function of time due and
difficulty(?) or Should I write a naive bayes classifier that'll look into the
words and assign the for me (obviously based on some training from my daily
input). Then I got started hacking scripts to manage it, realized I wanted to
access them through my phone so that I can update it from anywhere.. ok since
this is just text based, I'll keep ssh open in my router (umm, yeah its a
security issues) ... but I also need to integrate it up with google calendar
and task list ...

EPIC fail. This year only laundry lists in phone.

------
unimpressive
I already know that I spend too much time on things like Hacker News. (Which
is why I take ironic and self deprecating usernames like unimpressive.)
Reading, while helpful, isn't helpful past a certain point. The problem is
that reading feels just as helpful when you need it as it does when you don't.

It's certainly easier to do something after having read about it. But how much
can you really do, and how much of it is truly relevant to your goals? You
can't help but feel that not tapping into powerful tools like RSS feeds is
damaging in some way. Intangible as it is.

------
Osmose
My personal habit is to play with a small deck of business cards, or sometimes
a koosh ball with thin filaments. Both provide a pleasing tactile sensation
and are easy enough to mess around with while thinking.

I also find it helpful to use this downtime to review how I've been working.
The best thing I learned from the Pragmatic Programmer was to review my coding
techniques and patterns, and see where there could be an improvement. Perhaps
I spent the last 20 minutes fixing the wrong problem, or perhaps I didn't use
a design pattern that would've made my code cleaner and easier to understand.
Micro-breaks are a great time for these reviews because the code is fresh in
your mind, whereas a retrospective when a release is done requires a lot more
looking back.

------
farkob
I don't think this article offers anything to solve the problem. I believe
most of the people can identify the problem. Yeah you check your mail or
facebook while you're working and it causes productivity loss. But just being
aware of it doesn't solve the problem. It's like when people try to lose
weight they know they have to eat healthy or less but just knowing that again
doesn't make them easily lose weight. Because just like losing weight, the
problem about productivity isn't about knowing what to do or what not to do.
Everybody knows what to do, it's simple, no distractions = better work. Real
problem is avoiding that one quick facebook check every day and every hour.

------
aDemoUzer
I don't compile (web application) but have period of time when I am running
test suite and have to wait.

If I have such free time, there is always something else work-related for me
to do, since I am not tasked with only coding. \- Go over the code I have just
written.

\- It is time to commit, so look at diffs and commit.

\- Check the server's performance.

\- Go over list of pivotal stories and see what I be doing next.

\- Take a break, go for a walk around in the building, check out the beautiful
view.

\- Go over calendar and see if there is anything I need to not-forget.

\- Read something related to programming, a book at work or an article.

\- Have a talk with fellow co-workers about something that has been on your
mind.

------
stephen
I have the best luck staying on task by doodling--keep a pad of paper and pen
on my desk, and while waiting for compiling/whatever, just draw.

It's like being bored in class but still needing to pay some amount of
attention.

[http://www.npr.org/templates/story/story.php?storyId=1017270...](http://www.npr.org/templates/story/story.php?storyId=101727048)

There was also a TED talk that was pro-doodling, so it must be awesome, right?

<http://www.ted.com/talks/sunni_brown.html>

------
yason
I think I just mostly try go with the flow. Often I don't succeed in that but
sometimes I do and it feels good.

Give me an interesting task that has few dependencies to others and you're
going to have a hard time removing me from the computer. Give me a loose task
that requires a lot of waiting and you're going to have a hard time removing
me from HN or from other interests.

If I try to be highly productive all the time, I just fail myself and get
depressed. Since that doesn't work I try to optimize my workflow by working on
things that benefit from the idle lulls. Tasks that last days or weeks are
most suitable: there might be a lot of "idling" but when I get to writing code
I can bang 16 hours straight and accomplish in a day what would otherwise have
taken ten days.

Conversely, doing a lot of communication-bound work will soon make me feel
busy and exhausted. I'll be waiting or polling something all the time, and
what's worse, I can't start anything I think is real work because I have to
maintain the stack of pending tasks all the time so I know how to unwind when
they finish one by one. If I dive into something then it'll take even more
time for me to figure out what to do when I next hit the event loop again.

I try to teach myself that even little work _is enough_ : working like I would
love to work, the artist's way of work, is pretty much impossible in a
business environment. If I'm confident I've done enough eventhough it's
nothing compared to a weekend roll with a hobby project, then I don't feel so
bad about getting "nothing" done. And when I get done a lot, I try to enjoy it
as a precious window of time rather than the minimal bar I should reach in the
following weeks.

------
johnwatson11218
One thing that works for me is to have a technical book as a pdf that I can
switch to during compile/deploy cycles. The difference is that since it is a
technical book that is slightly different than what I'm coding on the context
switch isn't that great. Also, pdfs are longer and there is another context
that I switch into rather than a list of new topics on Hacker News. It isn't
perfect but it seems like a step in the right direction.

------
jpatte
IMHO this also as a lot to do with setting an appropriate work environment. On
a desktop designed for work you should only have links and bookmarks related
to your work. A bookmark to Facebook is a constant reminder that there might
be something new on Facebook, and it's sole effect is to distract you.

I also noticed that having an appropriate background music is important. In my
case I like to listen to Progressive Trance music (mostly ETN.FM Channel 2),
and I have hundreds of recorded shows of 1 or 2 hours each. The goal here is
to maintain a rhythm : keep going as the music goes on. I never listen to this
music when I'm not working, so I ended up naturally associating it with work.

Every time a music show ends, I take a few seconds to look back on what I did
during the last hour : did I complete my task ? Do I need a break ? If I feel
stuck or tired I stop the music, switch environment to browse
Facebook/Mail/HN/whatever, then come back 20 or 30 minutes later. Then I start
by "reloading my context", reminding what I was doing and what problems I
needed to solve, having a look on my TODO list (paper), and when I feel ready
I start the music again and begin coding.

------
matheusalmeida
I have to agree with the author of the post. I had the habit of checking my
personal email, read BBC to see it the world was not in war and checking HN
while the project I was working was building (I thought it was no big deal
<http://xkcd.com/303/>). The big deal is that it affected my productivity.
Period. When the program finished building or it aborted in the middle of the
process of building, I was still thinking about something I read. It always
took me some minutes before I was ready again to continue where I was.

Since the project I'm working can have long periods of building time (~up to
40minutes), I've started several projects while waiting for the program to
build. Since they are all related to coding, I feel that I can swith taks much
easily than reading news/checking email. And I believe I'll become a better
programmer because of that (also because the projects I've started are tools
to help me to perform my work).

------
voidr
What if our brain is actually a multi core machine that has millions of cores?
Would you still force it to use one core?

What if the task you just put into background kept working on it's own?

I think humans were built to multitask, our environment is too complex to be
single threaded, think driving: you need o pay attention to multiply things at
the same time.

~~~
greenyoda
Software development seems to be something that's very different than what
humans were "built" (evolved) for. During the millions of years over which our
brains evolved, we had to be acutely aware of our environment so that we
didn't get eaten while foraging for food. Driving might be similar to that:
keeping your eye out for danger while your main goal is navigating your car to
its destination. But that doesn't suggest to me a million-core machine -- it's
more like a foreground process with a couple of lower-priority background
processes. And adding just a few extra distractions to driving -- cell phones,
texting, kids yelling in the back seat -- increases the probability of
accidents, which suggests that our capacity for attention is quite limited.

However, software development calls for a very different kind of mental work,
one we couldn't have evolved to be good at since our species only started
doing it very recently: juggling multiple levels of abstractions in your head
along with countless low-level details. That's so hard to do that trying to do
it concurrently with other tasks severely degrades our ability to do it. Paul
Graham wrote about this very eloquently in his essay "Holding a Program in
One's Head" (<http://paulgraham.com/head.html>).

------
ohyes
If you find yourself getting distracted a ton, maybe you should take a step
back and look at what you are working on?

Do you believe in it?

Do you find it challenging and interesting?

Are you working on something that is important to you and makes a difference?

It isn't about every individual piece of the software being important, it is
about being excited about the sum-total and wanting it to be the best that it
can be.

I think of it kind of like momentum. You need enough momentum from rolling
down the big hill of 'oh my god i'm working on this cool thing', to be able to
deal with the uphill of 'mundane crap'.

If you are starting surf HN/Reddit/Facebook like an ADD net-squirrel, maybe
you need to work on something cool that you actually _want_ to work on. When
you've gotten to a good/excited place on the cool thing, switch back to the
mundane crap.

------
tathagatadg
The last article I read before going to sleep was
[http://en.wikipedia.org/wiki/Attention_deficit_hyperactivity...](http://en.wikipedia.org/wiki/Attention_deficit_hyperactivity_disorder)
\- feeling disgusted that surely I'm that unfortunate guy, who was not
diagnosed early and carried this into my adulthood. But that this article sits
on top of HN, makes me feel better - I'm not alone with
(speed_of_inspirational_input > speed_of_implemented_idea).

My question is be it pomodoro or this bigger focused chunk - I've always
struggled at the boundaries. Say you are not done at the end of the stipulated
time for focused work - there's this one liner fix that'll only take a second
- and that blows it. Ever fell into that trap?

~~~
hmigneron
I struggle with the boundaries as well. Especially at the end of the day or
before lunch. "This will only take me 1 minute" fixes turn into half-hours and
ruin the whole schedule.

One thing that might be worth trying is to just stop working whenever your
time chunk is done, regardless of what's left. I remember reading an article
here on how Hemingway used to stop writing in the middle of a sentence at the
end of a creative writing session. The author was suggesting that programmers
do the same thing (leaving a half completed function or even line of code,
even if it means that the project isn't building).

I tried it after reading the article and I was very surprised with the
results. I find it much easier to start in the morning when I have a half
completed line of code in front of me. The context comes back almost
instantaneously and even when it only takes me a minute to finish what I had
started the day before, I feel like I am already in the flow and I will be
much quicker when I start the next task. When the first task on my list is to
start a feature for example, I often end up browsing the code files aimlessly
trying to find the starting point, etc.

Ever since I started using this technique, I find it much easier to just stop
at the end of an allocated time chunk. It's only a question a perception
obviously, but instead of feeling like I have given up on a task before it was
done, I think of it as a way to set myself up for the next time chunk.

~~~
tathagatadg
Great tip, Sir :D. 'll adopt it right away ...

------
SonicSoul
i found the Pomodoro technique helpful <http://www.pomodorotechnique.com/>

and if you're honest with yourself, it gives a useful measure at the end of
the day of how much time was spent on uninterrupted work.

------
twiceaday
I find that it depends on the project, but there have been times when I am so
focused I start coding in the shower. Then proceed to forget to eat
breakfast... lunch... and dinner. I just forget about my body.

~~~
amrtn
That have not happened to me even once. My brain needs too much sugar to
function propery and if I miss a meal he won't work at all. On the other hand
I can easily disconnect my body from my brain while riding my bike and forget
completely about eating & drinking. When I reach my limit I faint, stumble and
fall.

------
Achshar
I am the distraction junkie type but in a good way i guess. Loud music nd
distractions (both online and offline) are the main drivers of my workflow. I
find that if i have some kind of a mental feeling (out of the computer
context) to push me through that code problem which won't solve, i can work
alot faster and efficiently. For example i dont have a smartphone right now
but i can get one if i finish my current gig then i really think about
smartphone in my free time. It keeps the furnace hot :)

------
xarien
How do you value inspiration or innovation stemming from distractions? I'll go
on a limb and state that distractions can be more productive than zen
coding...

~~~
libca
I think it is great to be distracted to be inspired, BUT when inspired,
without focus you will never realize all the great thoughts.

It's the same thing my yoga teacher told me - when you do anything - you have
to focus as hard as possible, as long as possible. Then re-focus to other
thing and never float like a leaf on pond - this won't get you anywhere.

------
damian2000
+1 for the breakdancing horse! I found I tend to be distracted more easily
when I'm working on something that is repetetive or isn't really challenging.
When I'm working on a serious bug and trying to solve some problem, I don't
have any problem getting into 'the zone'.

Its interesting that in Sweden they have workplace laws actually requiring
that anyone working at a computer screen gets 10 minutes of rest (away from
the screen) every hour.

------
potomak
I think I'm a distraction-junkie, I'm using Tomatoes[1], a tool to measure
coding slots with pomodoros. It works great, but when I'm compiling my code,
in my case running tests because I work on web applications, I can't resist to
check email. I'll try useful tips from the article like reading while waiting
for long tasks.

[1] <http://tomatoes.heroku.com>

------
tobiasSoftware
I would add to this a way to keep on coding while compiling. Sometimes I read
the code, which does give a coding break since I am taking input and not
producing output. However, at the same time I might discover errors, figure
out better ways of coding something, and learn or remember how to software I
wrote works.

------
melling
Perhaps the Go language will help the distraction-junkie. Build times of
seconds, even for very large projects.

[http://stackoverflow.com/questions/2976630/why-does-go-
compi...](http://stackoverflow.com/questions/2976630/why-does-go-compile-
quickly)

~~~
secoif
This is also a benefit of interpreted languages like Ruby or JavaScript.

~~~
davidcuddeback
Not necessarily. It can take a long time to load a large project, including
any Rails applications. A typical Rails application can take about 30 seconds
to load (that's any time you run a Rake task, launch a server, run unit tests,
etc) and unit test runs can typically take a few minutes, often times more
than 10 minutes for large applications. If you use a test server, such as
Spork, the load time largely goes away for running your tests, but there's
still a few seconds of startup time. Just because a language doesn't have an
explicit "compile" step doesn't mean its void of compiling-related problems.

~~~
getsat
> A typical Rails application can take about 30 seconds to load

Typical? Wtf kind of codebases have you been working on?

The largest Rails app I've worked on had 250 models and 200 controllers. It
took 12 seconds to load the Rails environment on Ruby 1.8.

Rails 3.1+ on 1.9.3 is pretty darn fast, even for medium-sized apps (50+
models).

------
j_baker
Am I the only one who feels that distraction isn't necessarily a bad thing? I
find that even my most productive days aren't distraction-free. And oftentimes
my best ideas come when I'm most distracted.

~~~
shnacker
I find controlled-distraction -- set times when I let myself be distracted
(such as: 'at 2pm I will spend 15 min reading HN) -- is helpful. Otherwise I
don't think sporadic, intermittent distraction could be of much use.

------
dancingrobot84
Great article. BTW does somebody here know great timer app for Mac or Linux?
I'm trying this "60 work / 30 rest" pattern, but sometimes problem is so
interesting and I just can't keep track of the time:)

~~~
nn2
Open a terminal and type

sleep 30min ; mplayer xxx.mp3

Don't need any ticking timer, it will just distract you. But if you really
need it's only a few more lines.

I used to do sleep 60 min ; find / to wait for the hard disk noise but that
doesn't work anymore since i have a SSD.

------
splicer
_That time is ridiculously tiny compared to the rest of your workday_

The project I was working on a few months ago took 40 minutes to build on an
i7 with 8 GB of RAM.

~~~
joezydeco
How long for an incremental change to the code? Say, if you touched only one
source file?

------
Void_
I read this article while waiting for the deploy. Whoops.

------
rbanffy
If you are reading this during work, you probably are closer to distraction
junkie. ;-)

I think I can reliably derive my focus from the traffic between my machine and
HN.

------
conradfr
I have ADD and I am in an open space. It's hard sometimes.

Fortunately I do PHP and do not need to compile ;)

------
dropshopsa
LOL, I checked this post while I was waiting for my programe to compile.

~~~
nazgob
meta!

