Think programmatically

التفكير بشكل برمجي

Thinking programmatically:

“I don’t understand the code. Starting from scratch seems
difficult. How many languages should I learn? I don’t know how to
think like a programmer, so I don’t think I can do it.”

This sounds familiar. Many people try to learn Java because their first programming language wasn’t properly understood and was merely memorized, facing the same problem.
Even developers who use another programming language have the same issue with JavaScript. Replace the phrase “You can’t think like a programmer” with “You can’t think in Java”.
It won’t take long, so let’s dedicate a day today to learn to think programmatically. To be able to learn all languages easily, my friend, programming languages are just translations of your thinking in structural ways.

Steps for thinking programmatically:

To easily overcome cases of programmer’s block, you can follow the four guidelines below:
1. Break down the problem into smaller problems.
2. Find solutions for the smaller problems.
3. Combine the solutions in a consistent manner.
4. Iterate and refine.

Here’s a detailed explanation:

Break down your problem into pieces.
How do you put a giraffe in the fridge?
Here are some answers:
1. Open the fridge.
2. Put the giraffe inside.
3. Close the fridge.
Problem solved.
Logical thinking in this question reveals some unanswered
questions.
1. Which fridge are we talking about?
2. What type of giraffe are we talking about?
3. What if the giraffe is too big to fit in the fridge?
4. Where is the giraffe located?
5. How does the giraffe get into the fridge?
When writing code instructions, you need to address each small
question possible. Therefore, the first step is to break down the
problem into parts.

Find a solution for each piece.
The second step is to find a solution for each small problem. The important thing here is to explain in as much detail as possible.
1- Which refrigerator? The kitchen refrigerator.
2- What about the giraffe? The African one.
3- What if the giraffe is too big? Part of it using a gun.
4- Where can I find the giraffe?
5- How do you transport the giraffe in Africa? In your car and return to your country.
You may need to delve deeper to get the answer you need. In the example above, you can examine answers 3 and 4 in more detail.
1- Where did you get the gun? I borrowed it.
2- Where can I find a giraffe in Africa? – Adding the Giraffe Park in South Africa.
If you answered all the small problems, you can put them together to solve the big problem.

Combine the pieces
In our example of putting the giraffe in the refrigerator, you can:
1- Get a gun from a local shop.
2- Travel to South Africa.
3- Go to the Park.
4- Garden to find giraffes.
5- Spray the giraffe with the gun.
6- Put the shrunken giraffe in the bag.
7- Return to the airport.
8- Go home.
9- Go home.
10- Put the giraffe in the refrigerator bag.
Has the problem been solved?

To think like a programmer easily. The key is knowing how to break down the problem into smaller problems.
After dividing the problem, search for solutions to these smaller problems and program them. You will continue to discover more problems that you did not think of before solving them.

When you complete answers to each small problem, you will find the solution to the larger problem. Sometimes, you need to connect the steps you wrote to each small problem.
After all, finding the first solution is not the end of your work, but there is always room for improvement. Take a break and work on something else. You will know that there is a better solution when you return. And rest assured, my friend, that a professional programmer is one who thinks logically and puts a plan in their mind before any code, as programming is not just writing code, but it is a way of thinking and a way of life.

 

 

 

Share Information:

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest articles: