How to Think Like a Programmer

Feb 22, 2019 - 2 min read

My notes from How to think like a programmer - lessons in problem solving.

1. Understand

  1. You understand a problem when you can explain it in plain English. If you can’t explain something in simple terms, you don’t understand it.

2. Plan

  1. Plan your solution. Write down the exact steps.
  2. Answer this question: “Given input X, what are the steps necessary to return output Y?”.

3. Divide

  1. Break problem into sub-problems.
  2. Solve each sub-problem one by one.
  3. After solving each sub-problem, connect the dots.
  4. Sub-problem doesn’t just mean problems that can be broken down due to their modularity. Sub-problem means try to reduce the problem to something simpler.

If you’re stuck, you should reduce the problem to something simpler. Instead of the third-highest number, what about finding the highest overall? Still too tough? What about finding the largest of just three numbers? Or the larger of two?

4. Stuck?

  1. Happens to everyone. Take a deep breath.
  2. The difference is better programmers are more curious about bugs/errors than irritated.
  3. Start anew. Delete everything and begin again with fresh eyes.
  4. Research but look only for solutions to the sub-problems. Because you won’t have learned.

5. Practice

  1. Try to solve at least one challenge every day.

If you want to see what business leadership may look like in three to five years, look at what’s happening in online games.