Think Horses not Zebras

Two of the most fundamental skills to have as a software developer are good diagnostic and problem solving skills. Unfortunately, it seems like the kids coming out of the universities these days do not know how to actually solve problems. Sure, they can solve a problem within the academic environment, but put them in the real world with a strange problem and they have no idea where to start.

So, where do you really start? The best place to start is with the principle of Occam’s razor. I won’t bore you with the full definition of the principle, but to condense it, it's where the simplest explanation is usually better than the complex one. Hence, if you hear hoofbeats, think horses and not zebras. I cannot count the number of times I have seen developers spin their wheels for hours over a problem whose answer was simple and staring them in the face. While the simplest explanation isn’t always the source of the problem, usually the simplest explanation is also the easiest to test. Starting simple saves frustration and time.

Every software developer maintains some pride in their code regardless if they admit it or not. As a result, that pride can keep us from looking at our own code as carefully as we should. We have all that those moments where we realize that we have been looking over mistakes in our code; we just couldn’t see it before. Keep an open mind and realize that every mistake that you catch is a learning moment.

Always attempt to fully understand the problem before you start “fixing” something. So many developers get a glimpse of a solution and immediately start coding; a big no-no. That mentality leads to you fixing the symptoms and not the underlying issue. Just treating the symptoms will more than likely cause the issue to rear its ugly head at some later point in the project. When you think you may have a solution ask yourself a few questions.

  • What is the context of the problem?
  • What is this code actually attempting to do?
  • Does my discovery explain the behavior completely?
  • What other areas of the code does this impact?

While these are just a few hints to help you on your way, please realize that good problem solving skills come with time and practice. If you don’t solve problems, you won’t get any better. Happy coding!

Summary:

  1. Start with the simplest explanation
  2. Check your code more thoroughly as you are more likely to miss mistake that you have made.
  3. Fully understand the problem before attempting to fix it.