Let Your Projects Breathe
This past week at the Portland Ruby Brigade meet up we did an exercise called Conway’s Game of Life. The details are here, but basically it was meant as a way to work on good coding practices and share different ideas for approaching the problem with one another. My partner and I made reasonable progress given the time span (about 30 minutes), but worked far more slowly than we both would have liked, and were somewhat clumsy in our approach.
This weekend, I came back to the exercise and managed to complete it (minus any sort of cool interface) in just a couple of hours. I blew past the stage my partner and I were at in just a few minutes. This is not to brag (a more experienced developer would probably find the exercise quite easy - and it definitely wasn’t my partner’s fault we were slow, either), but to illustrate something that I’ve come to realize about programming, and work in general - sometimes all a problem needs to progress is a bit of a break.
I’ve had similar experiences to the above on more occasions than I can I count, on a variety of scales. Many times I’ve been stuck on one of those “impossible” bugs, only to walk away and come back 15 minutes later with a solution. I’ve also been unsure of how to architect an element of program, taken a weekend to let it sit, and then come back on Monday with the perfect course of action. And there have been instances similar to my experience above, where my first pass at a problem is slow and clunky, but then obvious and quick after I let it sit for awhile.
I had to train myself to have the discipline to approach things this way though. I think as a newer developer, it’s easy to become engrossed in a problem and not want to stop because you’re Just. So. Close. So you bang your head into a wall for hours, get tired, hungry, and frustrated, and ultimately don’t really solve much. But more and more I’ve been able to become comfortable with walking away from the computer with a riddle unsolved.
The reasons why this works are perhaps obvious, but worth thinking about anyways. For one, taking a break (either 15 minutes, or a couple of days), gives you time to rest. It’s simple difficult to focus and think hard for hours on end, especially about just one thing. You are not a robot. Second, letting something be for a bit can help you gain a new perspective on it. When you’re taking a break and actively not trying to think about something is sometimes when the best epiphanies take place. My mind will drift to something inadvertently, and boom, I have a new idea to try. This process is just about the same as learning something, or developing a memory. In the same way that it simply takes time and a lot of “background rehearsal” in your head for something to be encoded, our minds will actually do a fair amount of problem solving when left to their own devices for a bit.
So here I stand in defense of taking a break. Sometimes, it’s the most productive thing you can do.