“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs
If you're into programming, you've most certainly seen this quote from Steve Jobs.
But, what does it exactly mean – to think like a programmer? And how do you do it?
In essence, it's all about a more effective way to solve problems.
By the end of this article, you'll know all the steps it takes to become a better problem-solver.
Why is this important?
Problem-solving is the meta-skill.
We all face problems daily, big or small. How we deal with them is sometimes pretty random.
Unless you create a system, this is most likely how you “solve” your problems
- Try a solution
- Didn't work? Try another one
- Didn't work either? Go back to step 2
Not to say that you will never luck out. But essentially, that is the worst way possible to solve problems. And it's a huge waste of time.
The best way involves having a framework and 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 (if not more so) than the baseline technical skills required for a job.” — Rank (2018 Developer Skills Report)
Having a framework
In order to find the right framework that works for you, I highly advise you to read the book on learning “The 4-hour Chef”.
To test the framework, you need to know what you should do when you encounter a new problem?
Here are the steps to follow:
1. Understand the problem
You need to know exactly what the problem is. If you fail to do this, you might lose precious time working on something that doesn't affect the main problem at all.
Most hard problems are very hard just because you don't understand them. This is the main reason why we listed this step as the first.
How to know when you understand a problem? When you can explain it to a 5-year-old. In plain English!
You most certainly remember yourself being stuck on a problem, and when you start explaining it you instantly see “holes” in the logic you never saw before?
The majority of programmers know this feeling.
That's why I always advice to write down your problem. Write down a diagram, tell someone else about it or whatever makes you say it out loud. Or, you can go with something fun like the rubber duck technique.
The rubber duck technique is very famous among programmers.
“If you can’t explain something in simple terms, you don’t understand it.” — Richard Feynman
2. Plan solving it
Don't just dive into solving it without a plan. It might feel sometimes that you can muddle your way through. Plan your solution first!
Nothing can help you if you can't break it down in exact steps and write them down.
In programming in general, this means you don't start chopping right away. You should give your brain time to analyze the problem and process the information.
To get a great plan, answer this easy question:
“Given input first, what are the steps necessary to return output second?”
If you know this, you're good to go.
3. Divide it
Pay attention to details. This is the most important step of them all. It's one of the crucial advice I'd like to give to programmers.
Don't try to solve a huge problem. You might start crying, and no one wants to see that.
Instead, you should break it into smaller problems. These smaller problems will be much easier to solve.
Then, only after you solve the first one, you should continue to the next one and so on.
Note: You should start with the easiest sub-problem The simples one might include the one you know the answer for, or are close to it.
Only after you solve every small problem, you should start connecting the dots.
Connecting all your small problems will give you the solution to the original huge problem.
This technique is a cornerstone of problem-solving. Remember it and use it every time.
“If I could teach every beginning programmer one problem-solving skill, it would be the ‘reduce the problem technique.’
4. Are you stuck?
By now you're probably reading and thinking “Hey, that's very cool and all, but what if I'm still stuck and can't solve a particular small problem?”
First of all, take a deep breath and calm down. Secondly, that's fair.
Next, you should know that you shouldn't worry at all. It happens to all of us!
The difference is that the best problem-solvers are very much curious about bugs than angry at them.
In fact, here are three techniques to try when you're facing a complex problem:
- Debug – Go step-by-step through your solution and try to find where it all went wrong. Programmers call this debugging. Actually, this is all a debugger does!
- Reassess: Take a step back and look at the bigger picture. Take a look at the problem from another perspective. Is there anything that you might've missed?
- Research: Thank God we have Google! No matter what problem you have, someone almost certainly had it and solved it. Find that person and solution, and give it a like/upvote/clap whatever. In fact, do this even after you solve a problem. You will be amazed by other people's solutions.
Side note: Don't work on a solution to the big problem. Only look for solutions for small problems. The reason behind this is that unless you struggle, you will not learn anything. And if you're not learning, you're just wasting your time.
Practice – and then practice some more
Don't expect to be great after a week or two. It doesn't take two weeks to become one of the best programmers.
If you want to become a great problem-solver, you have to solve a lot of problems!
Practice! Then practice some more! It'll only be a matter of time before you'll start recognizing that “Hey, this problem could very easily be solved using this”.
How to practice you ask? There are tons of options!
Chess puzzles, math problems, Go, Monopoly, Sudoku and countless other options that are endless really.
In fact, a very common pattern amongst successful people is their habit of using “micro problem-solving”. For instance, Peter Thiel plays chess, and Elon Musk plays video-games.
Just to clarify things – Don't just play video games all day long. Don't use this as an excuse to play video games.
But in essence, aren't video games all about problem-solving? They sure are.
So, you should find an outlet to practice. Something that allows you to solve tons of micro-problems. And if you can, pick something you enjoy doing.
For example, I solve coding challenges for fun. Every other day, I try solving at least one code challenge to keep the engine running.
Alicia leads content strategy for LearnWorthy managing a team of content producers, strategists, and copywriters. She creatively oversees content programs, awareness campaigns, research reports, and other integrated marketing projects.