Almost every programmer knows what it means to get in the zone. That weird feeling you get at two in the morning while working on a side-project, when the the time flies by and suddenly all important features are done. Mastering the zone is a crucial element of maximizing your productivity, but it can also be quite difficult.
Because the being in the zone is a very fragile state, it is important to reduce the risk of falling out of it. That means both preventing interruptions by outside sources like coworkers (within reason) and playing your own monkey brain to stay focused by reducing the possible distractions, like closing all non-related windows/tabs.
These simple methods can work sometimes, but to master the zone and be able to reliably enter it almost at will, a more sophisticated solution is needed, a system. There are a great number of systems, and most of them are designed to dictate a structure for planning work, so they can help take the last bit of excess cognitive load off your mind, leaving you with just the next problem to solve to think about.
One of the more simple systems is Pomodoro. Pomodoro in a nutshell is dividing work into relatively small tasks, spend 25 minute intervals working on these tasks and taking breaks in between. This approach forces you to focus on the task at hand, making it easier to get in the flow. It is also a rather simple system, you can read its Wikipedia page in two minutes and then start using it, and the overhead is very small, which is why I like using it for most of my coding.
If you have never used such a productivity system, I urge you to give Pomodoro a try, there is not really anything to lose, and possibly a lot to gain. You can also combine it relatively easily with larger-scale systems, like Agile or Scrum.