What you need to do to think like a programmer

  1. Why is it important?
  2. Find the pattern
  3. 1. Understand her
  4. 2. Plan
  5. 3. Break down the problem into small sub-problems.
  6. 4. Stuck?
  7. Practice
  8. Named the 5 most popular programming languages ​​according to HackerRank
  9. How to become a programmer, if you really want, but there is no experience

What does thinking like a programmer mean? In fact, everything is in a more efficient way to solve problems. Blogger and mobile application developer Richard Rees gave some tips on how to develop a computational way of thinking.

Why is it important?

Problem solving is metanavyk. How do we cope with them? Pretty random. If you do not have a system, you are most likely to “solve” problems in this way:

  1. Try the solution.

  2. If it fails, try another.

  3. Repeat step two until lucky.

So do not. This is a huge waste of time. You need to a) find a pattern and b) practice.

“Almost all employers first of all look at how employees solve problems. This skill is more important for them than knowledge of programming languages, debugging and system design. Computational thinking and the ability to cope with large and complex problems are valued in the same way as the basic technical skills needed to work, ”- HackerRank (Developer Skills Report 2018).

Find the pattern

“Novice programmers often focus on syntax, not problem solving. And this is the biggest mistake. ” V. Anton Sproul .

What should you do when you face a new problem?

1. Understand her

You need to know what is required of you. The tasks seem complicated because you do not understand them. How do you know if you understand the problem or not? Try to explain it in simple language.

Photo: Unsplash

This happens quite often: do you get stuck on a task, start explaining it, and suddenly notice logical shortcomings? Most programmers are familiar with this feeling. Write down your problem on paper or tell someone about it.

2. Plan

Do not proceed immediately to solving a problem without a plan. Nothing will help you if you do not write out the exact steps. Give the brain time to analyze the problem and process the information. To make a good plan, answer this question:

“Suppose there is an X at the input. What steps are needed to get Y at the output?”

Programmers have a great tool for this ... Comments!

3. Break down the problem into small sub-problems.

This is the most important step. Do not immediately try to solve one big problem. Instead, break it into small puzzles and solve them gradually. Start with the simplest — that is, the one you already know the answer to. As soon as you cope with all, connect the dots. So you can solve the original problem.

“I always advise novice programmers to simplify the problem. Let's imagine that you need to write a program that reads ten numbers and determines which one will be the third largest. For beginners, this task may seem very difficult, despite the fact that its solution requires knowledge of the basic syntax. If you get stuck, try to simplify the problem. Instead of the third largest number, try to find just the largest of all. Still hard? Find the largest number of three given. Or two. Simplify the problem until you understand how to solve it. Then gradually complicate the task and rewrite the solution ”, - V. Anton Sprol.

4. Stuck?

Now you probably think: “Well, yes, this is, of course, great, but what if I am stuck and cannot solve even a small problem?”

Photo: Unsplash

Do not worry. It happens to everyone. The difference is that programmers do not get angry when faced with this. On the contrary, they are interested in finding a solution. Here are three ways to do this:

  • Rate again . Look at the problem from the other side. Is there something that can be presented in a simpler way?

“Sometimes we get lost in the details and miss the general principles that would help solve the problem faster. The classic example is the sum of consecutive numbers - 1 + 2 + 3 + ... + n. Karl Friedrich Gauss presented this in the form of the expression n (n + 1) / 2, and he did not have to perform unnecessary calculations. ”

There is another option - to completely rewrite the code. Delete everything and start over.

  • Explore . No matter what problem you are trying to solve now. Someone has already done it before you. You just need to search. Do this even if you have solved the problem.

Practice

Do not think that in a week you will become a master in this field. If you want to solve problems well, do it regularly. Practice. Chess, math problems, sudoku, go, monopoly, video games, cryptocotics - all this will help you to perfect your problem-solving skills. Famous people do that too. For example, Peter Thiel plays chess, and Ilon Musk - in video games .

"Ilon Musk, Reed Hoffman, Mark Zuckerberg and others argue that the games laid the foundation for their success" - Mary Meeker .

Does that mean you should just play video games? Not really. Of course, you still need to learn. Find something where you could practice your skills.

Materials on the topic:

Named the 5 most popular programming languages ​​according to HackerRank

12 signs of a bad programmer - we identify a layman

How to become a programmer, if you really want, but there is no experience

How I quit my job as a graphic designer and became a frontend developer in five months

Found a typo? Highlight text and press Ctrl + Enter

Why is it important?
4. Stuck?
Why is it important?
How do we cope with them?
What should you do when you face a new problem?
How do you know if you understand the problem or not?
What steps are needed to get Y at the output?
Still hard?
4. Stuck?
Now you probably think: “Well, yes, this is, of course, great, but what if I am stuck and cannot solve even a small problem?
 
Карта