Getting into zone is a pleasurable and fruitful process. We produce good source code and we get lots of satisfaction from our work done while being in the zone. But, how does one get into the 'zone'? Do you follow a specific process? Apart from switching of email system, mobiles and other mundane non-productive applications, is there anything else that can be done?
Concentrate on what you need to do. Make the effort to actually start doing it. This can be one of the hardest things - to actively stop fluffing about.
Don't have email open. Don't have Fakebook in another window. Don't have any StackExchange going. No forums. Only quiet. And then get on with it.
It generally takes me (and pretty much everyone else I know) about 15-20 mins to get there.
You can generally sustain "the zone" for about 2 hours, and generally only once per day - its mentally pretty tiring. If you are super-duper you might manage it twice in a day. After "the zone" the rest of your day is pretty much lightweight by comparison, you get things done but the burst of huge productivity is over.
Oh - and getting out of the zone takes about 3 seconds - eg a phone call, or somebody sticking their head and saying: "Can I bother you for a moment" - to which the answer is: "yes, you already did". Bang. The zone is gone. Another 15-20 to get back.
Amazing how many stupid s/w defects get introduced by getting knocked out of the zone.
Amazing also how many people (esp managers) think that open plan is a really good way to develop quality software (where nobody EVER gets into the zone let alone stays there).
One thing that I've found to be helpful in getting into the 'zone' is actually 'zoning out'. I typically put on headphones and listen to instrumental, not lyrical (in my specific case Dj Tiesto) while trying to ignore the outside world. The headphone and music act as a barrier from the outside world. Studies have proven that listening to classical music helps concentration.
This solution may not be optimal in the corporate environment as connectivity and communication are pivotal, however if the situation allows, listening to music in the background, or on headphone may help.
...the documented productivity gains provided by giving knowledge workers space, quiet, and privacy. The classic software management book Peopleware documents these productivity benefits extensively...
Here's the trouble. We all know that knowledge workers work best by getting into "flow", also known as being "in the zone", where they are fully concentrated on their work and fully tuned out of their environment. They lose track of time and produce great stuff through absolute concentration. This is when they get all of their productive work done. Writers, programmers, scientists, and even basketball players will tell you about being in the zone.
The trouble is, getting into "the zone" is not easy. When you try to measure it, it looks like it takes an average of 15 minutes to start working at maximum productivity. Sometimes, if you're tired or have already done a lot of creative work that day, you just can't get into the zone and you spend the rest of your work day fiddling around, reading the web, playing Tetris.
The other trouble is that it's so easy to get knocked out of the zone. Noise, phone calls, going out for lunch, having to drive 5 minutes to Starbucks for coffee, and interruptions by coworkers -- ESPECIALLY interruptions by coworkers -- all knock you out of the zone. If you take a 1 minute interruption by a coworker asking you a question, and this knocks out your concentration enough that it takes you half an hour to get productive again, your overall productivity is in serious trouble. If you're in a noisy bullpen environment like the type that caffinated dotcoms love to create, with marketing guys screaming on the phone next to programmers, your productivity will plunge as knowledge workers get interrupted time after time and never get into the zone.
With programmers, it's especially hard. Productivity depends on being able to juggle a lot of little details in short term memory all at once. Any kind of interruption can cause these details to come crashing down. When you resume work, you can't remember any of the details (like local variable names you were using, or where you were up to in implementing that search algorithm) and you have to keep looking these things up, which slows you down a lot until you get back up to speed.
Here's the simple algebra. Let's say (as the evidence seems to suggest) that if we interrupt a programmer, even for a minute, we're really blowing away 15 minutes of productivity. For this example, lets put two programmers, Jeff and Mutt, in open cubicles next to each other in a standard Dilbert veal-fattening farm. Mutt can't remember the name of the Unicode version of the strcpy function. He could look it up, which takes 30 seconds, or he could ask Jeff, which takes 15 seconds. Since he's sitting right next to Jeff, he asks Jeff. Jeff gets distracted and loses 15 minutes of productivity (to save Mutt 15 seconds).
Now let's move them into separate offices with walls and doors. Now when Mutt can't remember the name of that function, he could look it up, which still takes 30 seconds, or he could ask Jeff, which now takes 45 seconds and involves standing up (not an easy task given the average physical fitness of programmers!). So he looks it up. So now Mutt loses 30 seconds of productivity, but we save 15 minutes for Jeff...
The other answers about how to concentrate and not getting disturbed are good and I have not much to add to them. The only fact I am suspicious about are rules about concrete numbers (how much time it needs for...). I am convinced that such numbers cannot be generalized in such a way. However it is important to concentrate on your task and to avoid getting disturbed.
The task you are working on is also very important!
Here are some general rules about the task you are working on:
- One must be involved in an activity with a clear set of goals. This adds direction and structure to the task.
- One must have a good balance between the perceived challenges of the task at hand and his or her own perceived skills. One must have confidence that he or she is capable to do the task at hand.
- The task at hand must have clear and immediate feedback. This helps the person negotiate any changing demands and allows him or her to adjust his or her performance to maintain the flow state.
Csikszentmihalyi, M.; Abuhamdeh, S. & Nakamura, J. (2005), "Flow", in Elliot, A., Handbook of Competence and Motivation, New York: The Guilford Press, pp. 598–698
These rules are not specifically related to software development but can be applied to them easily.
Just to add some examples on how you can check if these conditions apply to you and your task:
Do you know what will be your next commit? Maybe set smaller goals? DO you use Test-Driven-Development? Do you have the necessary knowledge to complete your task? Do you work with an IDE? etc...
This is only to give you an idea how it can be applied to programming, it cannot be generalised.
Get the first task on your well maintained list.
The secret is having that list!
There is one really effective way to beat procrastination. It has been described in the book Getting Things Done.
First you have to maintain a list of things to do. The methodology proposed is great (read it on wikipedia).
Then it's the way you write your tasks.
Rather than writing:
Do the documentation of the new ui (ouch a good candidate for procrastinators)
Call Robert to ask him to include Take screenshots of the new UI Write a summary about what to say Etc.
The trick is that tasks are small, and are actual actions. It's easy to start. And everybody here know that when you started, you have beaten procrastination.
What do you mean by zone? Is it when you are so focused on your work that you forget to eat and the rest of the world and all the people in it seems like white noise when you are focused completely?
I admit I can't do it everyday but on a day when I hit that zone,
Music or headphones with no music is a great way to get into the zone. Make sure you do not plugin your headphone into the computer, make sure it's plugged in to your ipod or mp3 player. This is because it's really easy to go to youtube or start downloading stuff....when your sound source is only music and nothing else.
When you reach the point where you are not focused on hearing the music and it rather sounds like white noise, it's a confirmation that you are now in the zone.
A much more easier way is to just start coding to get the fire going basically....but sometimes just to get that initial stage is tough....well take the music you hear, really listen to the music and get into the music....channel that passion in the music now to your code.