What is the best way to learn programming?

learn how to code, the best to learn how to code: algorithms
Algorithms: the best way to learn how to code

There are different learning styles and methods documented in pedagogy books. However, non of them explain what is the best way to learn how to code or programming-related topics.

Do you want to learn how to code? Do you want to know the best way to make it happen? If you answer with two yes then this article is for you.

In this article, I will give you my recommendation, according to more than 20 years of learning and teaching programming related topics, on what I believe is the best way to learn and study programming related topics.

Learning styles

All of us have different learning styles. Most of us have more than one. What this means is that we learn better in different ways. Some of us are better visual learners, while others are better verbal or social learners.

Although this topic is not about learning styles, it is always good to be aware of our learning style.

Do you know what is (are) your learning style? Check bellow the names so you can become aware if you still don’t know how you learn better.

  1. Visual learners
  2. Aural learners
  3. Verbal learners
  4. Social learners
  5. Logical learners
  6. Physical and tactile learners
  7. Solitary learners
  8. Naturalist learners

I won’t explain these learning styles, because it will make this article unnecessary long. You can know just by the name, what is the meaning of each one.

Learning tips from Harvard Professors

Below are some tips recommended in a book written by Harvard professors.

Practice Retrieving New Learning from Memory: This means you must question yourself all the time about what you are reading. What is the most important of what you read? Can you repeat it?

Space Out Your Retrieval Practice: Live a space between the practice sessions.

Interleave the Study of Different Problem Types: Study different types of problems/solutions at the same time.

The three previous recommendations can be apply to learn how code. However, you still need to know what your focus must be. Keep reading and you will find it in the next section.

My recommendation on the best way to learn how to code: Algorithms

During my professional journey, I found out that most students fail to learn how to code because they are using the wrong approach.

I’ve seen students fail, and also students to learn and become good programmers.

Based on my experience, I suggest the following:

Change the way you think when trying to solve a programming problem

Learning how to code, is to learn how to solve someone else’s problem by creating a program that will be executed on a computer.

Therefore, you are not solving the problem yourself, you are “teaching/telling” the computer how to solve the problem.

Are you getting the point?

Let’s say that someone asked you to create a calculator app, the person wants to be able to do certain calculations in an easier and faster way. You first document the operations the person needs (usually called requirement analysis in software development). 

When you create the program or application, what you have done is creating a sequence of instructions that tell the computer how to do the desire calculations, and you also “tell” the computer how to interact with the person that has the problem you want to solve.

Once you finish with the coding/programming task, you teach your client (the person that asked you to create a calculator) how to interact with the computer, through your program and get the results needed.

In other words, learning programming means to learn how to tell the computer what to do. But, for you to do that you have to know how to do it yourself. If you don’t know how to do the operations your client wants to be available in the app, you cannot create a calculator app. This idea is quite different than other areas of knowledge, see the following examples:

  • A mathematician is tasked to prove a theorem. The mathematician will make a proof using one of the methods that are appropriate for the task. He or she does not have to think about anything else, but about applying the methods to solve the specific problem.
  • You go to the doctor because you have pain, the doctor gives you a prescription and probably a checkup date in a few days.

Do you see the pattern?

Algorithms are the key

An algorithm is a finite sequence of steps,

that can be executed in a finite time,

 to give a solution to a problem.

Computers cannot think, although recent advances in artificial intelligence. Therefore, we must tell the computer what to do. For we to do that, we need to specify the sets of steps or calculations the computer must execute, in an unambiguous manner, and in a way that, if they are executed as specified, always we will get the expected output (the solution to the problem). 

If we cannot do that, our program or application won’t solve the problem that needs to be solved.

When you write/design an algorithm, you have to think how the computer will take action, the steps defined in the algorithm are not for you to execute them, therefore your way of thinking has to change.

You might hear or read, “the best programmers are good in mathematics”. Mathematics is not compulsory to learn how to code, but it helps a lot. 

In mathematics, we learn how to solve exercises through algorithms and abstractions. The last one is most of the time used in programming as well.

Just to give you a flavour of what an abstraction is, think about a cellphone. For you, a cellphone might be a nicely designed box, that allows you to make phone calls, send messages, connect to social networks and the many other functionalities a cellphone give us. But that is an abstraction because a cellphone is more than that, how many components are inside the box? What are their names? How do they connect to a communication tower?

As you can see now form the questions above, there are many things we don’t know about cellphones but still, we can use them, we have a picture of what a cellphone is and what can we do with it. The way that we build software is by using abstractions all the time.

I also strongly recommend to learn the fundamentals, don’t stop at learning how to apply something in programming, but learn how and why it works. Always go to the fundamentals, go as deep as you can in your programming studies. If you cannot go deeper at a certain stage, ask for help, but don’t stop until you learn the fundamentals.

Just as a summary, the best programmers out there are the ones that are best at algorithms. Change your mindset to think algorithmically, and you won’t have any problem to learn how to code.

Last but not least, you need to understand that there is no algorithm to solve programming problems. 

There are different techniques, different algorithms that you can learn and when you have to solve a certain programming problem, you have to be creative, and be able to apply the knowledge you got in solving that specific problem.

Are you ready to learn how to code? Set up your SMART goal and start learning. If you want to read about smart goals, you can read this post.

Leave your thoughts about the topic in the comment sections.