Learn to think and solve problems like a true programmer!


In this article, my goal is to guide you through the correct steps to becoming a better solver.

Why is it important?

Problem solving is a very important skill.
Unless you have a clear system, often this is probably the way to "solve" a problem:
  1. Try a solution
  2. If that does not work, try another way.
  3. If that does not work, repeat step 2 until you are lucky.
But this is the worst way to solve a problem and waste your time.
In my opinion, the best way to solve a major problem is to
a) Have a framework 
b) Practice it smoothly. According to the Hacker Rank's 2018 Developer Skill report :
Problem solving skills are almost the most important criteria employers seek ... more important than programming language proficiency, bug fixing, or system design. In other words, soft skills such as problem solving are as important as the basic technical skills needed for the job.

There should be a framework

To find the right framework, I followed advice from Tim Ferriss's book, The 4-Hour Chef .
I have the opportunity to talk to two really impressive people: C. Jordan Ball (ranked first or second among the 65,000 users on Coderbyte) and V. Anton Spraul (author of Think Like a Programmer: An Introduction to Creative Problem Solving ).
So, what should you do when you encounter a new problem? Please follow the steps below:

1. Understand the nature of it

Know exactly what is being asked. Most difficult problems are because you do not understand them.
How do you know you have understood a problem? When you can explain it simply. Richard Feynman said, "If you can not explain something simply, then you do not understand it."
When you start explaining it, and immediately see the loopholes in logic you have not seen before. Most programmers know this feeling. And that's why you should write down your problem, draw a diagram, or tell someone about it (even with a rubber duck).

2. Make a clear plan

Do not go into solving without a plan and just rely on luck. Instead, plan your solution and write down the correct steps.
In programming, this means not to start hacking immediately. Instead, they spend time brainstorming for problem analysis and information processing.
To get a good plan, answer this question: For input X, what are the steps required to return the output Y?

3. Divide

Pay attention because this is the most important step.
Do not try to solve a big problem because you will cry out there. Instead, split into sub-issues, much easier to solve.
Then solve each one with the simplest word. In it, the simplest means that you know the answer and do not have to depend on others to solve it.
This technique is the basis of the problem solving process, so remember it (read this step again if needed). Spraul says:
   "If I could teach the programmer the problem solving skills, then that would be" reducing the complexity of the problem. " Suppose you are a programmer who is required to write a program to read 10 numbers and letters. Which number will be the third highest? For a new programmer, it can be a difficult task, although it only requires basic programming syntax.
When you have trouble, reduce the problem to a simpler level. Instead of the highest third, find the highest number. Is it still too hard? So what's the biggest number in 3 numbers? Reduce the problem to a level where you know how to solve it. Then, extend the problem a bit and rewrite the solution accordingly. Continue until you get back to where you started.

4. When the deadlock, what should we do?

"Hey Richard, that's great and all, but what if I'm stuck and can not even tell the difference?"
First of all, take a deep breath. Secondly, it is normal for everyone to get it.
So do not worry. This happens to everyone! The difference is that good programmers / problem solvers will feel more curious about the error and will not be baffled.
In fact, here are three things you'll want to try:
  • Debugging : Check your turn solutions to find out where you went wrong. Programmers call it debugging.
  • Reevaluate : Look at the issue from another angle. Is there anything that can be summed up in a more general way? Another re-evaluation is to start over. Remove everything and start over with a new perspective. I'm serious! You will be dumbfounded to see how effective this is.
  • Research : This is where Google shines. No matter what problem you have, someone may have solved it, so look for that person / solution. In fact, do this even if you have solved the problem because you can learn a lot from other people's solutions.
Again, do not look for a solution to the big problem. Only find solutions for side problems. Why? Because unless you have difficulty (even a little), you will not learn anything. If you do not learn anything, you are wasting your time.

Practice

Do not expect that everything will be great after only a week. If you want to be a good problem solver, solve a lot of problems. Practice. It will only be a matter of time before you realize that "this problem can easily be solved in an extremely fast way"
How to practice? Chess, math problems, sudoku, electronic games, cryptokitties, etc.
In fact, a common pattern among successful people is the practice of "solving the micro problem". For example, Peter Thiel played chess, and Elon Musk played video games.
Does this mean you should only play video games? Is not. What you should do is find an outlet to practice solving many micro problems, ideally the ones you like. For example, I like code challenges. Every day, I try to solve at least one challenge (usually on Coderbyte).

Conclude

Now you know better what it means to be "thinking like a programmer." You know that solving problems is an amazing skill that needs to be cultivated. And the more wonderful you know what to do to practice your problem solving skills.

Comments

  1. It would not be wrong to justify the fact that such a blog enhanced with very potential information, would always help an individual and group of companies to learn, understand and make a decision accordingly in their corporate world.
    Apparently I would like to give an overview of my company. We are HRSG “THE ULTIMATE CLOUD SOLUTIONS YOUR COMPANY NEEDS.” We help Multinational Companies to grow and give them a proven record support in “Recruiting, outsourcing, consulting, management software’s and Business solutions, enabling them to become a market leader.
    With over a decade of experience working with industry leaders, we are able to bring proven processes, top technology and best practices to provide you a full range of HR BPO solutions that are flexible, scalable, integrated and global.

    Attedance software Pakistan

    ReplyDelete
  2. Interesting Article. Hoping that you will continue posting an article having a useful information. Microcontroller and its Applications

    ReplyDelete

Post a Comment

Popular posts from this blog

Itinerary becomes freelance programmer

Open source: Why should we care about project management?