Solving problems like a coder

Problem Dec 04, 2018

This time I write about solving problems (like a coder), even when you are not going to code anything this is valuable information for anyone. You don't need special skills, I go thru common strategy on how to solve problems effectively.


When I started coding, I started by with learning language and then went thru everything with trial and error without giving even a small thought if there was a more efficient way than banging my head to a wall. The problem was, what I didn't realize back then, I didn't focus on actual issues and tasks properly. I just knew what I want and pushed thru with force.

Ultimately it worked out but, I wasted a lot of time which I could have invested to something else like learning more deeply language what I was using. Since I had no one to teach me, I didn't have any real-life example of how to approach the problems correctly.

After I learned how to solve problems (like a coder) I understood how this all could have helped in my school years, just if someone had told me how to think and tear problems to smaller ones. For example, many exams would have been easier for me, if this process had been taught in school.

So, it's one thing to learn a language but, it's equally as important to have the ability think how to solve problems in hand.

The Strategy

Problem-solving is a meta-skill, meta-skills are skills that are general and can be used in different situations. For example, you may have a specific way to learn languages, that is your meta-skill for language learning. The strategy I am going thru may be familiar for you already, and you just haven't noticed it yet, some of us have it built-in and rest of us can learn it. An important thing to remember is, whatever you are doing it will always need some practice to polish your skill.

I summarize this strategy to simple four steps.

Step 1 - Understand the problem.

This is the first step and the most important one. You cannot solve a problem if you don't know what kind of problem you are addressing. To be more precise, understand the question.

How one can know that question is understood correctly? Explain your problem, if you are able to do that, then you understand the problem. If you are not able to explain problem, you don't really know what you need to solve. In this case, you need to extract problem to smaller parts which can be understood more easily.

People have different ways to sort ideas and here are some of them:

  • Write down or doodle your problem. Writing/drawing by hand involves processes in the brain which will help you learn better and have a better focus on your problem.
  • Explain your problem to someone, even when the listener doesn't know what you are doing or is able to help you with it. Saying things out loud also boosts your thinking process, and you may find missing gaps that way.

Remember to focus more on why instead of how. Why your software is not behaving as it should. Why you have this problem and so on. Put effort and focus on small things.

Remember, the big picture is built from small parts.

Step 2 - The plan

Once you have solved what the actual problem is and understood it, you need a plan how you will proceed on dealing with the problem. You may already know how to solve your problem, you should still use some time to plan how you do it.

Why do you need to plan if you already know how to solve the problem? I want you to stop for a moment and think about your solution. At first, the solution may sound good, but usually, it's good to take a small moment to verify if it is really working and compatible with the big picture.

Planning may sound more complicated than it really is. You need to write down step by step how you will solve the problem. What steps are required to get the desired outcome?

Step 3 - Check what you have.

If steps 1 and 2 are done, double-check your solution. Does it give an answer to the question you had in the first place? This is important since it's easy to take many side steps while thinking solution.

Step 4 - Still stuck?

If you are still stuck, take a deep breath, go outside, get a cup of coffee. Relax, keep in mind this happens now and then to everyone. Patience is important, some problems may take longer to figure out than others. Taking some distance to your problem may help you find a different approach and new questions to answer.

Sometimes you may need to take a step backward and see if the problem is actually somewhere else.

What if you are not able to find a solution?

All problems cannot be solved by yourself, this is especially when you are developing software. Coding is sometimes mind bugging and time-consuming process, don't give up.

Use Google to find help. Remember, you should search the answers to small questions. Remember step one, small parts at a time. Do not try to search something like "how to code full featured webshop." You may find tutorials like that, but none of those will ever answer your question properly or really help you to make your product. You only get step by step instruction how to duplicate something, and that's not the best way to solve problems.

You could also ask help from someone, don't be afraid - everyone needs help now and then, all of us have been in the shoes of a beginner.

Sometimes you need to think what is blocking you or makes you feel you can't solve the problem. Write down possible reasons, find out are they real blockers or not. Can you knock them down with some tool, by learning more about a specific topic or just by asking help.

If you are still stuck, check if you can leave the current problem and head to next and come back to problematic one later on.

Example break down the problem

Let's take a small example of how to divide the problem into smaller parts.

You are coding a game, you have a high score list of top 5 players. You need to know who is on place two.

You can start to divide your problem into smaller parts.

  1. How to list all scores out?

2. How to know who has the highest score?

3. How to list the two highest scores?

Problem is divided into three parts now. You can start to code from the first question and list out all scores and go further from there when each step is done and working. After while you have code which will show you who is in second place.

How to practice all this?

As said, problem-solving like every other skill needs to be practiced. You now have a strategy in your mind how to work with problems, now you need to use it as much as possible.

There are several ways, some things work better for others. You need to find the best ways for you, it doesn't need to be coding, it can be anything as long as you have something to solve. If you like, solving small coding problems would be the best way to train your brain.

Some people play computer games to train problem-solving, some play chess and so on. It's good to remember, exercising your brain with puzzles and problems can help you remember things better and help you to concentrate better.

The reason, why I encourage you to solve problems and especially coding related problems is how it activates your brain. Researches are pointing out that coding has a clear, distinct activation pattern of brain regions which are related to language processing, working memory, and attention. Coding also involves logical thinking and creativity, so it's a whole-brain workout.

My upcoming coding course contains a full dedicated section on how to think like a coder with more examples and scenarios. You can find out more about my course from the previous article.

Mika Peltomaa

Full Stack Hero who is not afraid to step out from comfort zone. Developing apps for web and mobile is close to heart, including Game Development as a Weekend Warrior.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.