Solve problems like a programmer
If you're interested in programming, you've probably seen such sentences before:
"Everybody in this country should learn to program a computer because it teaches you how to think "-- Steve Jobs.
You may also want to know what it means to think like a programmer. How do you do it?
In essence, it's all about a more effective way to solve a problem.
Doing so will give you an exact idea of what steps to take to become a better problem solver.
We all have problems. Big and small. The way we deal with them is sometimes quite random.
Unless we have a system, this can be quite cumbersome.
If this doesn't work, try another one. If that doesn't work, repeat the second step until you get lucky. Maybe sometimes you'll get lucky. But this is the worst way to solve the problem. This is a huge waste of time.
The best approach is a) to have a framework, b) to practice it.
Almost all employers put problem-solving skills first.
The ability to solve problems is the most important condition for most of the employers to find employees, such as proficiency in programming languages, debugging, and system design.
Demonstrating the ability to think about computing or break down large, complex problems is as valuable as the baseline technology required for your work.
"The biggest mistake I see new programmers making is focusing on learning grammar, not learning how to solve problems." V. Anton Spraul.
So what should you do when you have a new problem?
Know exactly what is being asked. Most puzzles are difficult because you don't understand them.
How do you know when you understand a problem? When you can explain it in easy-to-understand language.
Do you still remember being stuck on a problem and you started explaining it, and you immediately found a logical vulnerability you didn't see before? Most programmers feel this way.
That's why you should write down your questions, scribble a chart, or tell someone about it.
"If you can’t explain something in simple terms, you don’t understand it”. --Richard Feynman.
Don't go into the problem without planning.
Plan your solution. If you can't write down the exact steps, nothing will help you. In programming, this means that you don't start programming right away. Give your brain time to analyze problems and process information.
To get a good plan, answer this question:
Given input X, what steps does it take to return output Y?
3. Break it Down
This is the most important step. Don't try to solve a big problem. Instead, break it down into sub-problems. These sub-problems are easier to solve. Then, solve each sub-issue one by one. Start with the simplest. The simplest is that you already know the answer (or closer to it).
After that, the simplest means that the solution to this sub-problem does not depend on the solution of other problems. Once you've solved each sub-problem, connect these points.
Connecting all your "sub-solutions" will provide you with a solution to the original problem.
This technology is the cornerstone of the problem. "If I can teach every budding programmer a problem-solving technique, it's "problem reduction techniques."
For example, suppose you're a new programmer and someone asks you to write a program that can read 10 numbers and calculate which number is the third largest. This can be a daunting task for a new programmer, even if it requires only basic programming syntax.
If you're stuck, you should simplify the problem to something simpler. Instead of looking for the third-highest number, isn't it better to find the highest overall number? How about finding the biggest of the three numbers? Or which is the larger of the two?
Narrow the problem to the point where you know how to solve it, and then write the solution. Then extend the problem a little, rewrite the solution to match it, and proceed until you get back to where it started.
“What if I'm stuck and can't even solve a sub-problem? " First, take a deep breath. Second, this is fair.
Don't worry, it happens to everyone. The difference is that the best programmers or problem solvers are more curious about mistakes than annoyed.
In fact, there are three things to try when facing disaster:
Debug: Check your solution step by step to try to figure out what went wrong. Programmers call this debugging (in fact, that's all the debugger does).
"The art of debugging is to figure out what you really tell your program to do, not what you think you're telling it to do. --Andrew Singer.
Reassessment: Take a step back and look at the problem from another perspective. Is there anything that can be abstracted into a more general way?
Sometimes we get lost in the details of the problem and ignore the general principle of solving the problem on a broader level.
Of course, the classic example of this is the sum of a long series of consecutive integers, i.e. 1+2+3+... +n, a very young Gauss soon recognized it as n (n-1)/2, thus eliminating the hassle of adding.
Another way to re-evaluate is to start over. Delete everything and start over with a fresh look. You'll be amazed at how effective it is.
No matter what problems you have, it's likely that someone has solved them. Find that person or solution. In fact, even if you solve the problem, do it anyway! You can learn a lot from other people's solutions.
So don't look for solutions to big problems. Look only for solutions to sub-problems. Why? Because you can't learn anything unless you're diligent. If you don't learn anything, it's a waste of time.
Don't expect to be great in just one week. If you want to be a good problem solver, you have to solve many problems!
It's only a matter of time before you realize that this problem can be easily solved by inserting concepts here. How do you practice? In fact, there are many options!
Chess puzzles, math puzzles, Sudoku, Monopoly, video games, etc.
In fact, one common pattern for successful people is to practice the habit of "micro-problem solving". For example, Peter Thiel plays chess and Elon Musk plays video games.
Byron Reeves said, 'If you want to see what business leaders will look like in three to five years, look at what's happening in online games. '
Fast forward to today. Elon Musk, Reid (Hoffman), Mark Zuckerberg and many others say the game is the foundation of their success.
Does this mean you should only play games?
What you should do is find an exit for practice. Something that can solve many trivial problems (ideally something you like).
Now, you know better what it means to "think like a programmer." You also know that solving problems is an incredible skill that needs to be developed.
Just when you think you've successfully crossed one obstacle, another obstacle emerges. But that's what makes life interesting.
Life is the process of breaking through these obstacles- a series of defenses that we must breakthrough.
Each time, you learn something. Each time, you develop strength, wisdom, and insight. Each time, more competition disappears. Until all that's left is you: the best of you.
Posted from my blog with SteemPress : https://www.knowkpop.com/solve-problems-like-a-programmer/