Are You a Zen Coder or Distraction-Junkie?(componentowl.com) |
Are You a Zen Coder or Distraction-Junkie?(componentowl.com) |
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.
The project I was working on a few months ago took 40 minutes to build on an i7 with 8 GB of RAM.
I think I can reliably derive my focus from the traffic between my machine and HN.
Fortunately I do PHP and do not need to compile ;)
- 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!
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...!).
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
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.
Be smart and be true to yourself, not a watered down version of someone else's life philosophy.
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.
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.
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.
EPIC fail. This year only laundry lists in phone.
It's not just that "other people operate this way" -- this is in part a side-effect of the increasingly powerful behavior techniques that are conditioning people to behave this way (see Stanford's "Behavior Design" http://news.ycombinator.com/item?id=3454469).
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.
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.
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.
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...
There was also a TED talk that was pro-doodling, so it must be awesome, right?
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.
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.
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).
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.
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.
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?
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.
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.
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.
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.
http://stackoverflow.com/questions/2976630/why-does-go-compi...
I switch between the two modes this article describes quite regularly.
Reflecting on it other things cause me to go into distraction mode are:
- Not sufficiently planning out boring changes (That's easy! Get stuck as I realise I've done it wrong. 1 hour later, oh, I'm reading HN, how did that happen?)
- Having to write large, but simple objects or CRUD code
- A change or bug that requires picking apart poorly written code. Refactoring helps me stay focused but that often feels like procrastination.
- Using a library I don't know well but is documented poorly
- Trying to get OAuth authentication working (every single bloody time, I hate it)
- Having to modify any existing javascript even if I wrote it, I find js so hard to re-parse. function, function, function, function, function, function. I can't pick out the flow of the code. One of the reasons I've never got on with Lisp either I think.
For the occasional productivity burst: schedule yourself a fake meeting, pick a lonesome place and your laptop, disconnect from instant messengers etc.
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.
When I need to really focus on something, I leave my cubicle and sneak away with a laptop to an empty conference room. This is the only way for me to work uninterrupted.
Move back from the computer, touch my index fingers to my thumbs, close my eyes, count down from 10, and say out loud (or write) "I am now working on (project)". It takes ~30 seconds and it works pretty well for me.
What is your ritual for getting out of the zone, out of curiosity?
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).
The brain has billions of cores on parallel units, but they are unconscious.
"Would you still force it to use one core?"
No, you can't use only one at all, but you use "the one",the conscious brain(that could only do one thing at the same time) to coordinate them all, you should "force" the millions of cores to work in the same thing at the same time.
"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."
They were built to multi task over the same thing. If you go hunting but you are also thinking on your girlfriend while you remember the taste of the food you ate yesterday and try your nephew does not get hurt you won't be as efficient as someone that focus all their senses and thoughts over one single task.
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).
On the other hand, I've learned a lot of new distracting sites this way :(