How to get in the zone in less then 60 seconds

Dr. EvilGreat hackers are 10 times more productive then mediocre programmers. What did I say ? 100-billion-gazillion times more productive. And you know it!

Getting in the zone allows you to be in a state where you’re completely separated from the outside world. It’s just you and the computer. Your fingers against a horde of bits. You know you’re in it when you notice 2 hours later that someone has walked inside the room you’re in.

Here are 5 tips that have helped me achieve that level of focus. I hope this is helpful to anyone else as it was for me.

1. Have a vision

Even before writing the first characters of code you should know in your head what you want the final product to look like. Doesn’t have to be all the details about the database schema and the methods arguments of every classes. But each classes relationship and role could be a good start. As an example, if I’m building a DVD collection website, it’s trivial to determine every possible field of the dvds database table, but it’s crucial to know my dvds table will be the centre of my app. If you have a clear vision, you’ll be driven by it and nothing and no one will be able to stop you from achieving it.

2. Find a setup and stick with it

Although I don’t think having a routine for everything is something good, you should have some fixed parts in your moving train towards coding nirvana. Determine in your vision what are the innovations and automate or routine everything else. For instance, the way you place the windows on your screen should always be the same when you enter coding mode. And when you stop programming, close all those so you record that having this setup mean you’re coding. This way you won’t be distracted by your Google Reader or Adium window.

4. Drop the mouse

no mouseNot using the mouse is the best way to become a very effective programmer. My philosophical reason is that you’re closer to the machine in the way that all you fingers are directly connected to your computer transmitting information as it pops up in your head. Switching from mouse to keyboard is costly, do it as less as possible or only for uncommon tasks.
Using the mouse is good for exploration mode, when you don’t really know what you’re looking for. But since you should have a clear vision of what you wanna do, go with the most direct method of input, the keyboard (until they find a way to connect it right into your brain).

5. Use tests to focus

A common problem with debugging is when you do it with puts (or Console.WriteLine or print) in the code. When you’re done debugging you remove all of them. So when you need to debug again, what ? You add the same puts and prints everywhere.
When debugging with tests you document your assertions in a permanent way. “I wanna make sure this returns ‘stupid puppy’ 46 times”, well don’t


  puts puppy.title

rather


  assert_equal "stupid puppy\n" * 46, puppy_output

in a test case.
The next time you’ll have to fix a bug or add a new feature you can focus on making the test pass, not scanning the output. As with the mouse, scanning is for exploration mode.

5. Put headphones on

headphonesListening to music occupied the left part of you brain. An old study presented in the amazing book Peopleware shows that if you listen to music while coding, you will end up with a less creative approach [1]. This might be true, with new music you’re listening to for the first time. My tip is to listen to music you know by heart. The objective is to eliminate any unexpected variant in ambient sound. If you know the music really well, you won’t be surprised by any sound, it will serve as a constant background noise. It’s a great way to focus real fast and cut yourself from the outside world, you know, the real world

Now what do you do to get in the zone ?


[1] He and his college made some programming test with people listening to music (own choice “if music” plus type of music in the affirmative) and people that were kept in a silent environment.
It turned out they program equally fast but the people listening to music show less creativity.
Some sub tasks of the test required a length transformation of some data. This was set up so it looked very complicated with a lot of steps. The end result however was that the transformation was very trivial and in come cases you ended up with the data unchanged.
The people listening to music missed this to a very high degree while the programmer working in silence almost uniformly spotted the simple transformation.
The suggested explanation is that the right brain more creative / insight dominated is used for listening to music while the logic left brain is busy coding. Those two task can be done fairly independent but when creativity is needed the right brain is busy so the broader insight into what is being programmed is often missed.
(Summary taken from bstadil, thanks)

14 Comments

Filed under Misc

14 responses to “How to get in the zone in less then 60 seconds

  1. Great post!

    For the music, yes, I stick to what I know and love. A play list of a genre that’s not too surprising can help too.

    When programming, I prefer a regular beat that’s fast enough. This way, you can blend points #4 and #5 and type to the beat. When you planned ahead and know what you need to program, typing to the beat really gets you in the zone.

  2. 0 – cut off the internet (ie twitter, google, rss and the like)
    For instance, Robin Millette has gone to extremes and he has a whitelist of domains he can go to. but that might be too much for the rest of us.

    5 – you can use Noise
    http://www.blackholemedia.com/noise/
    it produces white noise that eliminates background noise.

    what i do is that i also try to be light. ie i keep just the stuff I find necessary. otherwise it goes to the bin. because when you have too much to think of, with too much interruption, it kills the flow.

  3. @jerome yay! typing to the beat, that must be fun, I should try that. What kind of music do you listen to ?

    @heri I totally agree with cutting some apps, maybe having different bookmarks/browser for word/fun. But blocking domains is ratter rude in fact. Noise is interesting. Have you tried it, is it annoying after a couple of hours ?

    I also keep my desktop empty and use it as a temp dir.

    Thanks for the great tips!

  4. I’ve tried Noise. It does cut background noise, but I can’t stand it for more than 10-15 mins.

    http://projects.gerryscuppatea.org/NaturalWorlds/

    Natural Worlds creates background noise. It comes with 2 worlds, birds and thunderstorm. There are a couple more on the website, but they’re not very good. I personally quite like programming with a thunderstorm in the background. It’s a nice change from music sometimes.

  5. i have tried noise – but don’t have it my routine.

    by the way i use different combos (setups) depending on what i do. for instance, firefox has everything about montreal tech watch. it has gmail, google reader, and google apps.

    i use safari for web development and for web browsing (for websites outside of montréal). i also have a dedicated rss reader for websites outside montréal.

    i just tried the 4 by the way. i was working in textmate, but it didnt work. i had to use the mouse to scroll downwards. i also needed the mouse to test the website. so how do you do? your .rb files are all shorter than one screen? and you never use a browser to test your app?

  6. i think noise is more convenient for extreme noise situations.

    i will try natural worlds

    as a last word, does someone think that this thread sounds a lot like “how to be more autist” ? i would like to have more point of view from other developers and see if they all want to work like that (ie extremely focused and cut off from the rest of the world)

  7. Thanks for the pointer J-F, I’ll give it a try.

    Good point Heri. For my case, we do some pair programming at SoJ. I find it pretty useful especial at the beginning of a project as it enforce another eXtreme Programming practice, Collective code ownership. Even though I think being cut from the outside world is more productive, the counter part is if you’re off track with what you’re building, you’ll do more useless stuff before knowing it. This imply having tools like commit hooks and continuous integration server to close the feedback loop and engage communication when something don’t go as expected or break. That, plus weekly meetings of some sort, I don’t think you can’t escape that.

    I too would like to know if some programmers don’t like to work like this, being cut off from the outside world. I’ve never met any yet!

  8. Alain Pilon

    BTW, I also read Peopleware and the productivity ratio of excellent coder vs average was 17 times. Knowing that the average in this term must be around the median, it means that there is a possible HUGE difference of skills between various coders. But they are all paid about the same wage…

  9. Yeah that’s a shame. Good coders are usuality poor at negociating salary I guess.

    That reminds me of http://paulgraham.com/gh.html, excellent article by Paul Graham about what is a great hack and who much better they are from average ?

    Thanks for the comment Alain!

  10. webmat

    As I was subscribing to my usual feeds in a new reader, I stumbled upon this slightly old, but very interesting post.

    I’d like to add something else to the mix, even though it’s the kind of proposition that usually makes people shrug it off immediately because “It Doesn’t Always Work That Way”.

    So my tip is: Work with tools you love on something that interests you at least a little bit.

    I’m currently the living counter-example to that, at work, these days. I work in C++ in VS6 (yes, the one from 1998, before the .com bust), on a small tool to complement some horrible and obscure software. It goes without saying that I’m actually searching for another job😉

  11. webmat

    Yesterday I forgot to mention: In my actual situation I’m probably in the zone for 4-6h a week on good weeks. On most weeks it’s more around 0-2h.

  12. Hi Mat,

    omg that is awefull! Perhaps at home it’s easier to get in the zone?!

    Thanks for the comment and see you at the next MoR😉

  13. One good idea is to make your computer good-looking.
    Actually these sets of pc mouse and keyboard very nice,
    like hot cakes for the coming promotion season.

    Sex Beauty Mouse ( & its pad, men’s patent)
    Warm Mouse ( warm your hand in cold season)
    Skype Mouse
    Finger Mouse ( special for your laptops)
    Frog Mouse
    Soap Mouse
    Ocean View Mouse ( nice design)
    Handy Mouse ( off desk operation)
    Hello Kitty Mouse
    QQ Mouse
    Slim Bluetooth Mouse
    Smile Oil-fresh Mouse
    Colorful Flash Transparent Mouse
    5D wireless mouse
    Car Mouse
    Heart Mouse
    ..

    a. Watch Mobile Phone: All function in it, such as music movie player, hand writings, Bluetooth, usb disk, photo browse, etc.

    b.TV Mobile Phone, Games Mobile Phone, iPhone Alike

    c. Bear MP3 Player, Games PMP, Touch Screen Cross MP3 Player, Waterproof Mp3, Mickey Mouse MP3, Hello Kitty MP3, Smallest Mini Car MP3, Cube MP3, Christmas Card MP3, Watch MP3 MP4, Alarm Clock MP3, Pen MP3

    These models like hot cakes for the coming promotion season, welcome to discuss further cooperation.

    site:
    http://www.gadgetscn.com
    http://www.welteam.com
    msn: gadgetscn (at) gmail.com

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s