If you can’t solve a problem, take a step back

July 15, 2014

465 words, a 3 minutes read

Have you ever reviewed your life and thought “What was I worrying about back then?!”. If you do (you do), then take this piece of advice for your current problem. If something new shows up that you think is a problem, then try to see the bigger picture.

  • Problem: your car broke down
  • Immediate consequence: you have to commute via public transport, you’ll be 30 minutes late
  • Mid-term consequence: your boss may not be happy about this, but ask him if his car has worked every morning for the last 30 years
  • Long-term consequence: you won’t die of it, will you?

So don’t try to get too involved, or your emotions may overflow your stack and there’s no memory left for a real solution.

That being said, let’s move to problem solving. When programming, I often run into problems especially with new languages, where I don’t know the recommended way to solve it. I then remember having that problem in another language and try to google how to implement that solution in my new language (read: tool). That is completely wrong, but don’t get intimidated, I did that too. Raymond Chen describes this as:

Today is another example where the right thing to do is not to answer the customer’s question but rather to solve the customer’s problem.

http://blogs.msdn.com/b/oldnewthing/archive/2014/06/25/10537055.aspx

Read that article, he’s writing of the same thing I want to tell you. Instead of trying to re-implement your solution, take a step back what you’re really trying to do. You’re not asking how to set a pointer as a parameter in C#, you’re asking how to directly operate on an object passed to a function.

When you’re starting to program, you often have easy problems where you’re developing a little algorithm. Take this as an example:


Given a height h, write a program that calculates the amount of bricks needed for each line and in total.

You’ll be having a solution to this problem in no time at all. If you find this too easy, think of a solution for a 3D-pyramid like this, full and hollowed.

As you think of this solution, you’ll try to implement it. But you are not error-free and you will run into problems, especially as these exercises get more and more tricky. It has always helped me to just do something else. I even did that for this post when I had no inspiration for an example. Take a walk (Walking around the office can be weird, but it really helps. I think this is related to a stimulated blood flow, but I’m no physiologist), do some other work, just do something else than working on that very problem. Ideas and inspirations will fly through your mind, until it clicks and you really know how to solve it.