Posted on

Overthinking the problem

As a programmer, I solve problems. For my clients and myself it is important that I solve the problems as efficiently as possible with the caveat that the efficient solution must be scalable and have enough foresight as to cost effectively allow for unpredicted modifications in the future. A trap that developers fall into is overthinking the problem.

Imagine walking out of your house and realizing right as the door closed that you left your keys beside the television. Your mind races. You get all MacGyvery and start looking for a paperclip to use with your pocket knife as a makeshift lock pick. You ponder knocking out a window pane or lowering yourself down the chimney. The schemes escalate and become more elaborate. This is how a programmer overthinking the problem creates unnecessary levels of complexity which can lead to buggy code. The solution could be as simple as checking the other doors to see if one is open or getting the spare key from the neighbor. Or even more simple, doing a sanity check by confirming that the key is not in your pocket. Perhaps you didn’t even lock the door which is now the subject of your ornate plotting.

How can a programmer prevent overthinking a problem and wasting time?

  • Sleep! Sleeping on a problem gives the mind clarity. Sometimes we dream the solution and sometimes the break is enough to see the error in our ways.
  • Take a break! Similar to sleep, a diversion such as juggling, exercising, breathing fresh air, or working on a different type of problem can jolt our minds into seeing a simpler solution to the original problem. I highly recommend getting away from the computer but don’t abide by that myself. Often I will solve a sudoku puzzle or write a blog post to shock my mind into seeing a different solution.
  • Talk to peers. Other people’s input is often helpful in seeing a solution. With programming, like many aspects of life, there can be many solutions to the same problem and others can inspire us with their approach to solving the problem. If you work by yourself like I do, find peers online with IRC or Twitter.
  • Outsource. If a problem is being very difficult, give it to someone else. They may find it less complicated and it frees you to work on something different.

Using the same techniques writers use to alleviate writer’s block can cure coder’s block. Now I must return to the problem that I overcomplicated by overthinking it.

Leave a Reply