How to think like a programmer

If you’re interested in programming, you may well have seen this quote before:
Everyone in this country should learn to program a computer because it teaches you to think. — Steve Jobs
You probably also wondered what does it mean, exactly, to think like a programmer? And how do you do it? Essentially, it’s all about a more effective way of problem-solving.

In this post, my goal is to teach you that way. By the end of it, you’ll know exactly what steps to take to be a better problem-solver.

 

Why is this important?

Problem-solving is the meta-skill. We all have problems. Big and small. How we deal with them is sometimes pretty random.

Unless you have a system, this is probably how you solve problems (which is what I did when I started coding)

1. Try a solution.

2. If that doesn’t work, try another one.

3. If that doesn’t work, repeat step 2 until you get your luck.

Look, sometimes you solved with luck. But that is the worst way to solve problems! And it’s a huge, huge waste of time. The best way involves A: having a framework and B:practicing it.

Almost all employers prioritize problem-solving skills first. Problem-solving skills are almost unanimously the most important qualification that employers look for more than programming languages proficiency, debugging, and system design.

Demonstrating computational thinking or the ability to break down large, complex problems is just as valuable as the baseline technical skills required for a job.

 

So, what should you do when you encounter a new problem?

 

Here are the steps:

 

1. Understand

Know exactly what is being asked. Most hard problems are hard because you don’t understand them. How to know when you understand a problem? When you can explain it in plain English.

Do you remember being stuck on a problem, you start explaining it, and you instantly see holes in the logic you didn’t see before? Most programmers know this feeling. This is why you should write down your problem, doodle a diagram, or tell someone else about it.

 

2. Plan

Don’t dive right into solving without a plan. Plan your solution! Nothing can help you if you can’t write down the exact steps. In programming, these means don’t start hacking straight away. Give your brain time to analyze the problem and process the information.

To get a good plan, answer this question:

“Given input X, what are the steps necessary to return output Y?”

 

3. Divide

Pay attention. This is the most important step of all. Do not try to solve one big problem. You will cry. Instead, break it into sub-problems. These sub-problems are much easier to solve.

Then, solve each sub-problem one by one. Begin with the simplest. The Simplest means you know the answer or are closer to that answer.

After that, the simplest means this sub-problem being solved doesn’t depend on others being solved. Once you solved every sub-problem, connect the dots.

Connecting all your sub-solutions will give you the solution to the original problem. Congratulations! This technique is a cornerstone of problem-solving. Remember it (read this step again, if you must).

 

4. Stuck?

By now, you’re probably sitting there thinking that’s cool, but what if I’m stuck and can’t even solve a sub-problem? First off, take a deep breath. Second, that’s fair. Don’t worry, though, this happens to everyone!

The difference is the best programmers/problem-solvers are more curious about bugs/errors than irritated. In fact, here are three things to try when facing a whammy:

Debug: Go step by step through your solution, trying to find where you went wrong. Programmers call this debugging (in fact, this is all a debugger does).

Reassess: Take a step back. Look at the problem from another perspective. Is there anything that can be abstracted to a more general approach?

Research: Good ol’ Google. You read that right. No matter what problem you have, someone has probably solved it. Find that person/ solution. In fact, do this even if you solved the problem! (You can learn a lot from other people’s solutions).

 

Practice

Don’t expect to be great after just one week. If you want to be a good problem-solver, solve a lot of problems! Practice. Practice. Practice. It’ll only be a matter of time before you recognize that “this problem could easily be solved with “insert concept here.”

In fact, a common pattern amongst successful people are their habit of practicing micro problem-solving. For example, Peter Thiel plays chess, and Elon Musk plays video-games.

Does this mean you should just play video-games? Not at all. But what are video-games all about? That’s right, problem-solving! So, what you should do is find an outlet to practice. Something that allows you to solve many micro-problems (ideally, something you enjoy).

 

Conclusion

That’s all folks! Now, you know better what it means to think like a programmer. Happy coding! ✌🏻

error: Content is protected !!
Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.