How to Learn Any Programming Language in a Few Weeks
Here is how one can learn to code in Python, Javascript, and C++ by spending only a few weeks on each. However, learning a new language was not always this straightforward. When learning a first programming language, which was Java, it was common to spend months watching online tutorials and following along. But with a different approach, it's possible to deliver a project in a new language like Python within the first two weeks, even without having written a single line of code in it before.
This same method can be used to quickly pick up C++ and become a productive team member. It has been applied over and over again to learn other languages like JavaScript, Go, and Dart. But how is this possible? Is there a magic pill that transforms someone into a programming wiz overnight? The truth is, it’s actually very simple.
The Historical Secret to Rapid Language Acquisition
For thousands of years, great civilizations and powerful leaders have tried to uncover the secrets of learning a new programming language. To find the answer, we have to go all the way back to 1945. World War II had just ended, and after winning the war, the British wanted to spread English throughout the world. As you might already know, English is not exactly a very easy language to learn as a non-native speaker.
So, they created this simplified version of English called Basic English. Basic English had only 850 words. For comparison, there are over 170,000 total words in English. In addition to fewer words, Basic English also had simplified grammar rules, with a focus on basic sentence structures. To popularize the language, the state-owned British Broadcasting Corporation (BBC) created a show named “English by Radio.” This show taught Basic English vocabulary and pronunciation to non-native speakers and was a huge success.
But how could just 850 words and a few basic grammar constructs help people learn English? And can we use the same principles to learn a new programming language?
The Power of the Pareto Principle
To answer that, we need to know a few things about how languages work. Imagine a circle that contains the top 10% most popular words among the 170,000 total words in English. This circle would contain words like I, me, you, eat, drink, etc. Then we have another circle around it that contains the next 20% most popular words. This would contain words like overpaid and programmer, which makes sense. We can keep making these circles until we cover all 170,000 words. In case you are curious, the outermost circle contains words like nincompoop and teetotaler.
For simplicity, let’s combine the innermost two circles together and the rest of the circles together. Now, imagine that you start reading one of the best novels of our times, which has a total of around 150,000 words. What you’ll find is that roughly 80% of these words in the book lie in the inner circle, and the rest of the 20% of words come from the outer circle.
For those who don’t know, this is also known as the Pareto principle. The Pareto principle states that 20% of your effort results in 80% of your outcomes. This powerful principle is the main idea behind Basic English as well as the secret to learning a new programming language really fast. The same principle can be applied to learn French, and soon, “Je peux parler en français mais mon accent est marrant.”
Applying the 80/20 Rule to Programming
“Learning a new spoken language is one thing, but learning a language that a computer understands is totally different,” you might say. Well, let’s try to test this hypothesis. Let’s build the same circles for the vocabulary of programming languages.
What would be the top 10% most popular concepts here? I believe it would include different data types like int
, float
, string
, or Array
. Maybe if-else
blocks and for
loops would also be part of this circle. Perhaps writing functions and classes would also be here.
If you move outside to the next circle, you might have concepts like polymorphism and inheritance. And you can keep drawing these circles until you reach the outermost circle that might have, I don’t know, maybe iterators or generators.
Now, if you pick all the GitHub repos in the language of your choice, you will find that 80% of the code would be coming from the inner 20% circle. Following what we learned from the Basic English example, we will focus on this 20% circle first.
Key Considerations for Effective Learning
As we do this, we need to be careful about two things.
The Core Concepts Vary: This 20% circle, though fairly similar, might vary a little bit across different languages. For example, in Java, you might have an
ArrayList
, and you will call it just aList
in Python. Or in JavaScript, you might haveasync/await
, which might be very different in other languages. The point is, this top 20% circle might change depending on the language you pick. So, you would want to do your own research on the top concepts for the language of your choice.Change Your Method of Learning: When you are trying to learn these concepts, you need to change your method of learning. If you were trying to learn a new spoken language, let’s say French for example, no matter how many movies or TV series you watch in French, you will not be able to speak French unless you actually try to talk in French.
The Importance of Interactive Learning
In the same way, no matter how many lectures or video tutorials you watch in JavaScript, you will not be able to code in JavaScript unless you actually try to code in JavaScript. In a tutorial, you will usually get code that already works, and if you copy it, sure enough, it will work for you as well. But, programming is the art of breaking and fixing things.
That’s why interactive learning is recommended instead of casual learning. For example, if you want to learn Python, you can go to a site like learnpython.org
and do exercises, break things, and fix them as you learn new concepts. Similarly, for JavaScript, you can use a resource like W3Schools. I am sure you can find this kind of platform for other languages as well.
Now that you know what to learn and how to learn it, there are two problems left for us to solve: how to remember what we are learning and how to learn the rest of the 80% of concepts in the circle.
Overcoming the Forgetting Curve
To solve the first problem, we need to first understand the Ebbinghaus Forgetting Curve. Hermann Ebbinghaus was a German psychologist who is well-known for his work on memory and learning. He conducted experiments where he would give himself some nonsense words to remember and then test himself at various intervals to see how many of these words he could remember. What he found became the backbone of how we teach kids in the modern school system.
The famous Ebbinghaus Forgetting Curve illustrates a classical exponential decay. What this means is that right after we learn something new, we start forgetting it very quickly. But this rate of forgetting slows down over time, and in the end, we only retain a small fraction of what we learned.
But what if I tell you that there is a way to retain more of what we learned? Ebbinghaus also studied the impact of revision on our retention. What he found was that if you review the concepts again, you can increase the number of words you remember in the end. And if you repeat this multiple times, your retention can keep increasing. This is called Spaced Repetition, which many of you might have already heard about. This is the reason why if you try to learn a new language using an app like Duolingo, they keep repeating the same words again and again in the exercises.
The Ultimate Solution: Projects and Spaced Repetition
But how do we apply spaced repetition to learning a new programming language? The answer to this question is also the answer to the second problem that we still need to solve. So, let’s quickly cover the second problem and then we will talk about the solution.
The other pending problem we have is that we have still not figured out how to learn the remaining 80% of concepts. For this, we need to take a breadth-first approach to our learning. What this means is that instead of taking some random, long, deep path from the inner circle to the outside boundary, we just keep enlarging our inner circle. In other words, we slowly keep increasing the breadth of our knowledge. The biggest advantage of doing this is that we are only learning new things that are close to what we already know, and this makes learning them very easy.
But how exactly do we do this? To remember more of what we have learned so far and to learn the remaining 80% of concepts, all we need to do is build projects. But not just any projects—we need projects with increasing difficulty.
Building projects helps you in two ways:
- Spaced Repetition: As you build projects, you will encounter the top 20% of concepts again and again. This will help you achieve spaced repetition naturally.
- Progressive Learning: As you build projects, you will need to learn some new concepts on the go. If you choose your projects carefully and slowly increase the difficulty, you can constantly expand your inner circle to become the same size as the outer circle.
One thing that you should be aware of, though, is that you will never be able to learn 100% of what there is to learn. But look at yourself. You don’t know everything about the language that you speak, and you are doing just fine. So, don’t obsess over learning everything.
As mentioned, choosing the right projects is extremely important. Doing this will not only help you learn faster, but it will also provide you with a portfolio of projects that you can write on your resume to impress hiring managers.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.