Tired of ads? Enjoy an ad-free experience by signing up.
Valinda Chan · · 11 min read

10 steps for new developers to solve any programming problem

Photo credit: Tran Mau Tri Tam.

Some of the feedback I hear from new developers working on a programming problem revolves around an uncertainty of where to start.

You understand the problem, the logic, the basics of the syntax, etc. And if you see someone else’s code or have someone to guide you, you can follow along. But maybe you feel uncertain about doing it yourself and have trouble turning your thoughts into code at first, even though you understand the syntax or logic.

Here, I’ll present my process to tackle a sample problem. Hopefully, some of you may find this helpful in your programming journey.

1. Read the problem at least three times

You can’t solve a problem you don’t understand. There is a difference between the problem and the problem you think you are solving. It’s easy to start reading the first few lines of a problem and assume the rest of it because it’s similar to something you’ve seen in the past. Even if you are making a popular game like Hangman, be sure to read through the rules even if you’ve played it before. I was asked once to make a game like Hangman and only realized that it was “Evil Hangman” after I read through the instructions (it was a trick!).

Sometimes, I’ll even try explaining the problem to a friend and see if her understanding of my explanation matches the problem I am tasked with. You don’t want to find out halfway through that you misunderstood the problem. Taking extra time at the beginning is worth it. The better you understand the problem, the easier it will be to solve.

Let’s pretend we are creating a simple function selectEvenNumbers that will take in an array of numbers and return an array evenNumbers of only even numbers. If there are no even numbers, it will return the empty array evenNumbers.

Here are some questions that go through my mind:

  • How can a computer tell what is an even number? Divide that number by two and see if its remainder is zero.
  • What am I passing into this function? An array.
  • What will that array contain? One or more numbers.
  • What are the data types of the elements in the array? Numbers.
  • What is the goal of this function? What am I returning at the end of this function? The goal is to take all the even numbers and return them in an array. If there are no even numbers, the function will return an empty array.

2. Work through the problem manually with at least three sets of sample data

Take out a piece of paper and work through the problem manually. Think of at least three sets of sample data you can use. Consider corner and edge cases as well.

  • Corner case: a problem or situation that occurs outside of normal operating parameters, specifically when multiple environmental variables or conditions are simultaneously at extreme levels, even though each parameter is within the specified range for that parameter.
  • Edge case: a problem or situation that occurs only at an extreme (maximum or minimum) operating parameter.

Here are some sets of sample data we can use:

When you are first starting out, it is easy to gloss over the steps. Because your brain may already be familiar with even numbers, you may just look at a sample set of data and pull out numbers like 2, 4, 6, and so forth in the array without fully being aware of each and every step your brain is taking to solve it. If this is challenging, try using large sets of data, as it will override your brain’s ability to naturally solve the problem just by looking at it. That helps you work through the real algorithm.

Let’s go through the first array [1]

3. Simplify and optimize your steps

4. Write pseudocode

5. Translate pseudocode into code and debug

6. Simplify and optimize your code

7. Debug

8. Write useful comments

9. Get feedback through code reviews

10. Practice, practice, practice


Stay ahead in Asia’s tech landscape

You've reached your 2 free content limit for the month. Sign up for free to read the full story.

🏄 For casual readers / 👶 Free

Basic

US$0

Free forever

Get instant access to this article and more every month

0 premium content

Unlimited news briefs

5

5 articles

Ad-free reading experience

Just US$0 per day

⌛Sign up in 20s. No payment details needed.

📖 For learners / 👍 Starter

Lite

US$4.92/month

Billed annually at US$59/year

Get instant access to this article and more every month

4

4 premium content

Unlimited news briefs & articles

Ad-free reading experience

Just US$0.17 per day

Cancel anytime

Our subscriber community includes professionals from these companies:

Stay updated on the go with our mobile app.

Get latest insights with smoother, more personalized experience through TIA mobile app.

Community Writer

Valinda Chan

Full-Stack Development, Product & UX Design // Assistant Vice President @ Citibank Innovation Lab