It seems to me that the stronger my focus, the more productive I am when coding.
However it is very hard to remain tightly focused. So my programming productivity swings wildly as does my focus. I am trying to become more productive when I code, so I'm trying to train myself to remain focused for longer.
I'm interested to hear the thoughts of other people. How strong is your focus when coding? Do you get long stretches of focus and productivity? Or do you keep losing focus and having to work to bring it back?
Also, how old are you? I'm interested to know if it's easier to focus on coding when you are younger. I'm 45.
1. Write down the goal for that day that I need to accomplish before I start coding.
2. Break down the goal into mini goals.
3. Take a 5 min break after each mini goal is met. I usually just get up and look out through the window or do some light physical activity.
4. Before starting for the next mini-goal coding, I sit down and think how I am going to code.
5. Start coding while keeping the goal of the day on the top of my mind.
Personally, instead of coding, I believe that I am writing a poetry and unless I get the lines correct, I won't be able to write a beautiful verse.
There; I don't have to worry about focus.
I am 36.