Programming: the benefits of taking a break
- You work smarter, not harder. Once, I worked really hard at a feature. For two weeks, 12 hours a day, I put in a lot of effort. After those two weeks, I took a break and came up with several ideas that made much of the work unnecessary.
- You think more clearly. Being tired has a similar effect as being drunk. At the end of a day, I often kid myself that I’ll just get this one thing finished quickly to have a fresh start the next day. In reality, I usually need to clean up yesterday’s messes then. If instead I find the discipline to postpone, it only takes me a fraction of the time to accomplish the same task – with better results.
- You can be your own pair of fresh eyes. If you want to write quality code, code reviews (including their extreme version, pair programming), are invaluable. If I let things that I have written lie for a few days, I have forgotten enough about them that I approach them with a fresh mind. I’m almost my own code reviewer, which allows me to really improve the understandability of my code.
- Being nice to your body is good for your brain. Don’t forget that the latter is part of the former and adheres to biological principles. Especially people working with computers tend to focus too much on their brain and neglect the rest of their body. The brain needs oxygen, rest and nutrients to function at optimal capacity, so you need to breathe, sleep and eat properly.
- Communication is a different way of learning about a problem domain. You can view programming as solving a puzzle in a problem domain, as finding the best tools, techniques, and libraries to write your code. If you take a break from coding, you can attack the problem domain from a different angle – by discussing it with other people. It doesn’t matter whether you do so via talking to face to face, via social websites, via email, via Twitter, or via other tools. Swapping experiences gives you a new perspective on your code without doing actual coding. In a way, web searches are a uni-directional way of communicating, but they have become too much part of the coding routine to be considered a separate activity.