Its awesome to see how much can be done when you are focused on something. From programming, to writing an essay or reading technical information, its way easy and you retain more information and get more job done just by having focus.
Get rid of distractions
Sometimes, though, is really difficult to get into the zone. Usually because the constant distractions, trying to do many things at once, constant interruptions, having unclear propose, etc. So, how do I get focused? First of all, by reducing interruptions at all cost. The best way to do it for me is to ignore everything not related in what I'm doing. That means no phone calls, no facebook, no mobile interactions, no go to pee, not going to the fridge, no running if you hear FIRE. It helps me to put some music and headphones and we are ready to go. Get in front of the problem and anything but it is what you have to focus your attention. Force yourself. If you find yourself doing something else answer 'is this going to help to solve the problem you are doing?'.
Focus on a task
The second tip I follow is to have a clear vision in my mind of what I want to achieve; what needs to be done. Both in general terms, like how does this task you have fits in the overall project you are working on and how you want to solve this specific task right now. Everything you start a small task, finish it before starting anything else. If you leave things unfinished, then it will be more difficult to catch up. If you cannot finish the task for whatever reason, try to document exactly in what point are you, and what else needs to be done to finish.
Being focused means having all the 'traceback' in your mind. You know exactly what you need to do, and why you are doing it. You are in 'the zone'. Break this state and you'll loose all the details you had in your mind a second ago. That's why you don't want to be disturbed by anybody or nothing.
And, as all things in this world, the way of getting better on it is by practicing. Doing the effort of getting focused on something every day is the best way of getting better. Force yourself.
You also don't want to forget about doing breaks. If you get focus on something for a very long time (hours) you'll be unable to do anything else useful the rest of the day. Thats my experience at least. When I can really get in the zone a 10 minute break every two hours is OK, and it will be impossible to be in the zone for more than 4-5 hours a day. After that I'm pretty much useless, and I have to do jobs that does not require strong concentration. So, take breaks!
When anything is working
Sometimes it happens to me. I can do whatever I want but focus on a thing it needs to be done. I get distracted all the time by other stuff. This situations come in two different versions: short and long term periods.
If usually I can get in the zone and do stuff but one day I can't concentrate it can be because I'm tired, I haven't slept well or just simply I have a bad day. In this days I prefer to put off the job until I have my mind clearer.
If, instead, I've been days consistently not doing my task, this... well, sucks. You try to avoid the task, you start doing other things you think are more interesting and valuable, start new projects, etc. When this happens I take two different approaches: the first one is to try to do a little bit every day, no matter what. An hour of job is better than nothing. At the same time, I usually take advantage of the situation. If I'm unable to program but I find myself enjoying reading the documentation I'll need in a near future I allow myself to spend more time on it. If its fixing some bugs that I never had time for them but I really want them to be solved because they are annoying, instead of developing the main feature, its OK. After all, I'm not procrastinating but doing other stuff.
The second thing I do is to ask myself if this task that is taking me so long can be split in smaller pieces that will require less effort individually.
And thats all for today, folks. Thanks for being here.