It's actually part of why scheduled breaks are an integral part of my coding process. Alternating between projects, modularizing projects and working on different sections in turn, just plain getting up for a walk to clear my head.
It is all part of making sure I don't get bogged down on the simple projects. You cannot be productive sitting there working non-stop for hours on end. Admittedly, there ARE times you "get in the groove" and the hours fly past, but for the most part it helps to stop BEFORE you reach that point of frustration or overthinking one little piece of the puzzle so you can come back at it with a clear head.
If nothing else it's better for your health too to just get up and get out. Coding is a sedentary lifestyle, and the coder's diet of Coke and Crisps certainly doesn't help.
So PLAN on getting up every two hours to three hours, walk around the office, jog around the building... do something else. Even just five minutes away from a project can boost your productivity when you come back.