DEV Community

Cover image for How I approach solving problems in programming
Yahaya Oyinkansola
Yahaya Oyinkansola

Posted on

How I approach solving problems in programming

Problem solving is a skill every developer needs to have, but it is not so easy to learn and cultivate, it comes with practice and experience. In this article, I want to share how I typically approach solving problems I come across while I code which I think you would find helpful, especially new developers

1. Write problems in plain English

I learnt this method from Clever Programmer (A YouTuber), and it has been of immense help to me till date. Learn to write down your problems in plain english. When you keep looking at the problem from a coding perspective alone, it will be hard to understand how to go about solving the problem.

Maybe you have a problem where you want to put a background color on a link whenever the page changes. Instead of immediately thinking about how you would write the code, what you should try doing instead is explaining the problem in plain english, explaining how you can possibly arrive at the solution, before writing any code, it's a serious hack!. Let's apply this using the example I gave, and see how it would look like

"What i want to do is change the background color of the About us link whenever the user navigates to that page, and apply a .underline class to the text to make it underlined"

Can you see the difference?, This might be a very simple example, but the idea behind it is to make the problem less of a problem. When you approach solving problems like this, you will always most likely be able to solve them

Disclaimer - I am not saying this would always be easy. There are times when you will do this, and it will still be hard to solve the problem, but this is a method that works 98% of the time

2. Focus on what the issue is

Another option I like using is focusing on a particular feature I am working on, and removing every other thing that is distracting. What i mean by this is that if you are working on a feature, to gain better clarity on what you are trying to do, eliminate any other piece of code that is not necessary, and leave only that specific code you are working on. The advantage I found in doing this is that it helps me focus on what I am trying to do, and not get distracted looking at other lines of code. I used to battle with this a lot because I would be doing one thing, and all of a sudden I would be like "Why does this button have this many classes or styles?". Once I divert to that, I would have totally forgotten what I was trying to do initially, and 45mins would have past me without solving what the real problem was.

3. Learn to read error messages well

Yes i know, sometimes the error is not always descriptive enough, but still, it tells us what the problem is, we are not always just patient enough to read the writings. I feel like learning how to read error messages and decode them is a skill on its own, because you will always encounter bugs in your code. There is no developer that can code a full stack application without having one error whatsoever (If you have actually done this before, then I am jealous). We are all learning, and the more errors you solve, the better you get at knowing how to avoid them.

4. Learn to break problems down

You would have probably heard this one over and over again. The better you can break a problem down, the faster you can solve the problem you have.

One thing you need to remember is that programming is more than just coding, it involves so many processes that coding is like 20% of the Job. Learning to break problems down makes you a more valuable developer. Companies are after people who know and understand what they are doing, rather than someone who says they can write code in React.

5. Learn to use AI Properly

This might be surprising to some of you, but I can tell you that you are missing a lot by not taking advantage of AI to help you solve your problems, it is a serious game changer. Remember that the whole point of these tools is to help us be more efficient in our work. The only problem is that people can take this too far, and rely too much on AI. It is important to learn how to properly use these tools in other to get the best out of them. ChatGPT for example has been of tremendous help in solving certain programming problems I have faced, you just need to learn how to use prompts that give you the sort of answer you are looking for.

That is all I have to share on this topic, hope you found some of these tips helpful. Let me know in the comments how you approach solving problems, I would like to get as much insights as possible. You can connect with me on twitter and linkedin, happy Coding!

Top comments (0)