The life of a programmer is not very different from that of a normal person when it comes to solving problems. We also face unexpected situations every now and then. This is why one of our abilities must be to solve problems correctly and efficiently.

Here’s what has worked for me.

Simplicity above All

There’s a common belief that a complicated solution is the best.

A simple solution should be easy for a reader of your code to understand.
Keep it simple so that anyone can implement it easily.

And remember that the “reader” could be your future self.

Using Similar Solutions

Many problems have similar solutions. Your current problem may be similar to something you’ve solved in the past. If you remember how it was solved before, you don’t have to reinvent the wheel. Be pragmatic and adapt the solution.

The internet is an efficient tool to look for “inspiration.” Use your energy to find one the best solution out there. Inspiration can come from anywhere. Just remember to credit the author.

Quick Start: Use Paper

Sketching a solution is important before jumping to code it. For one, it allows you to catch errors before coming up with the final outcome.

The equivalent to this in coding is coming up with a pseudo algorithm. Jot down your ideas quickly. You can do anywhere, including on paper or your favorite text editor. Describe what to do step-by-step as if it were actual code.

Once completed, take a step back and ask yourself if that is all you need to do. It is not necessary to have a final product. You can modify it at any given time.

Iterate Your Solutions

Every programmer wants to come up with an optimal solution. However, you may not get there on the first attempt. Iterate instead.

Your first attempt be inefficient, difficult to read, and unsustainable. The important thing is that it works and something you can use as a starting point.

After several iterations, you may feel more comfortable with your creation. Keep working on it with the goal of making it better, learning, and improving yourself.

Seek Experts, Be an Expert

Do not be afraid of seeking more experienced people.

We are only human and we can’t know everything there is to know. Asking questions is better than wasting time, particularly when we know someone who already went through the same situation.

Be open to offering help when someone asks for it. Helping other also help you, and it even helps get ahead.

Recommended Resources

Use communities like Stack Overflow and Reddit. Each area has its experts, the sites are varied. It’s up to you to find out which one is right for your situation.

If you want to learn new things and be up to date, visit Codewars.

Check out HackerRank if you already have experience and want to solve more complex problems.

If you have any questions or comments, please reach out to me, Pedro Duarte, Software Engineer @Nearsoft.