Break the problem/task down into independent pieces. Independent means that the piece can be unit tested. Finish the piece and its unit test before you stop coding. Design a good api/interface/signature etc for each piece to enable re-use. A good design and unit tests also allows you to refactor later on without blowing the whole thing up.
Define productive programmer. Some one who can complete a given task efficiently quickly and precisely that meets or exceeds the expectations of stakeholder. To accomplish, please understand devil is in details.
1. Focus and understand the problem you are trying to solve.
2. Divide a strategy and divide the problem into multiple tasks. accomplish the tasks
3. After each task - make sure the solution for the tasks meets the requirements as defined in the task.
4. Once you complete all the tasks - you have solution for the problem.
Practice this over a period to perfect the art and you will be productive one day
Stay focused on the task at hand. If possible break it down into smaller tasks. If you have a hard time staying focused, use the pomodoro technique to get it done.
Some books that could help:<p>Brian Tracy - Eat that frog!<p>Brian Tracy - No excuses!<p>if you prefer a tldr: Self discipline is the key. Identify your long term targets and do one thing at a time until it is finished. Work on what you need to finish even when you don't feel like working.
My 2c.<p>Concentrate on one thing and get it done.
Break it down into chunks.
Write them in a todo.txt.
Get one chunk done and finished and committed before moving on to the next one.<p>For chunk size; I think a chunk is gonna take me 1-5 hours, and it usually ends up taking 0-5 days.
(1) Automate. Besides saving time, it helps generate different kinds of ideas.<p>(2) Have a bug tracker, and create in it smaller subtasks for a task. It dumps thoughts out of your mind, which helps focus on individual subtasks.