Stalled? Step away to solve.
No matter how many years of experience you have, it seems that there is always something new in the world of programming. It’s a constant process of learning, as programming languages, scripts, tools, software, methods and best practices evolve. Depending on the project, the work can also become abstract and quite challenging; especially when trying to come up with something unique or doing something new for the first time. Every programmer occasionally gets stuck and sometimes documentation isn’t enough, searching doesn’t reveal an acceptable answer and co-workers don’t have any helpful clues. While it may not work for every programmer, I’ve solved several of my most difficult coding issues away from a computer. Not in front of a whiteboard or with a notebook, but by completely taking a break from trying to solve the issue.
This concept certainly isn’t anything new and the sudden insights achieved away from the task at hand are usually referred to as “eureka” moments, thanks to the reaction Archimedes had after figuring out how to determine whether King Hiero II’s crown was pure gold while sitting in a bathtub (or so the story goes). There are many other examples throughout history. For example, Einstein solved special relativity while riding a streetcar home, alternating current came to Nikola Tesla on a walk, Newton famously came up with universal gravitation after seeing an apple fall from a tree, Otto Loewi came up with an experiment to determine how nerve cells transmit messages after dreaming about it and Descartes came up with the Cartesian coordinate system after watching a fly crawl across his ceiling in bed one morning.
While these examples are groundbreaking discoveries, the important takeaway is recognizing the pattern of how and when the problems were solved. Taking a break and performing a simple task to let the mind wander can be absolutely pivotal in complex problem solving. It is so easy to get locked in when you’re stuck on a programming issue, doing guess and check work over and over with no success or frantically searching Stackoverflow as the time ticks away. When I get stuck on a difficult problem and I’m unable to solve it in a reasonable amount of time, I try to step away. At Westwerk, this means playing a round of foosball, talking with a co-worker, going for a walk or even taking a bathroom break. Just sitting stationary staring at a screen and racking your brain as the stress levels rise is usually not the best approach in my experience.
Studies on how this might work break human thought into conscious and unconscious. It’s hypothesized that there is a high relation between unconscious thought and divergent thinking, which is defined as creative thinking, such as generating several possible solutions to a problem. From the conclusion of “Where creativity resides: The generative power of unconscious thought” by Dijksterhuis and Meurs published in volume 15, issue 1, March 2006 of Consciousness and Cognition:
“One could say that unconscious thought is more ‘liberal’ than conscious thought and leads to the generation of items or ideas that are less obvious, less accessible and more creative. Upon being confronted with a task that requires a certain degree of creativity, it pays off to delegate the labor of thinking to the unconscious mind.”
The real creative boost seems to happen after performing an undemanding and unrelated task during the break, not by just doing nothing. In a study by researchers at the University of California, Santa Barbara titled “Inspired by Distraction: Mind Wandering Facilitates Creative Incubation” that was published in volume 23, August 2012 of Psychological Science, it was found that in a repeated-exposure condition (coming back to the same problem), participants that engaged in an undemanding task during a break period performed 41% better than participants that rested, had no break or performed a demanding task during the break.
That’s a number that programmers and employers shouldn’t ignore. Having to generate new ideas to solve demanding problems is something that comes up in programming all the time, and the evidence from the studies referenced above, among several others, show that breaks can be an important part of the process. Giving yourself and/or your employees the flexibility to approach problem solving in ways that might not be considered normal in a typical office environment could translate to significant performance boosts and increases in efficiency.