image source: https://rustacean.net/
TL; DR
- Simple rule: learning a programming language is like learning a real life "foreign" language
- You need a motivation: Do you have any problem of interest, that could be easily solved by using that new language?
- Reading book is not always the answer: it depends on what level of the language you are at
- I would keep this very simple cycle: tutorial/book -> project -> tutorial/book -> project -> ...
Intro
Over the last 10 months, I have tried to steadily spent 30 minutes every day to read through the official guide book of Rust, a.k.a The Book. As you see, this is somewhat unreasonable amount of time for a book for a new language to be read(FYI, I am not a newbie programmer, and I have experience in various languages including Python, JS, and C++). As a matter of fact, I even skipped a few chapters that could be considered as references(14 - cargo, 18 - pattern matching, 19 - advanced features).
So I think it would be valuable to write an article of what I think I have learned from this unusual experience, to warn myself(if not others) in the future when I would need to learn a new language.
I have read this book for 10 months, so why?
Let me start with the reason why I choose to read this book. Everything began with my own thought and from other's opinions that Rust is a super powerful language and will become dominant in the software engineering field in the near future. So as many of you do, I searched on the Internet, usually Reddit, to find out what is the best way to learn it. Then I found The Book and tried to read through it.
However, as I was super busy at my work and my personal stuff, so I couldn't allocate enough time to read the book within short period of time. Thus I decided to read it rather in a steady manner, like a habit. Spending 30 ~ 60 minutes looked fair enough, and that was my misjudgement.
I am not blaming The Book. It is well written, with detailed explanations and examples. However, I've frequently felt boredom, as if I were reading some kind of a thick English grammar book of more than a thousand pages. I literally have had to drag myself to the end of the book, jumping over a few chapters that I thought I would never be able to read with more than zero interests.
So what is wrong with my approach to learn Rust with The Book?
A programming language is a foreign language, analogously
One of my colleagues in the previous job, who is a big fan of Rust, once gave me an advice: you should learn Rust by writing code, not by reading a book. In retrospect, I think he was absolutely right. Now I remember a few grammars, but I hardly can write a simple fizzbuzz logic with Rust!
It comes to my mind that learning a programming language is like learning a foreign language. Why not simply "a language"? Obviously, you don't get it for granted: you have to spend a lot of time to get used to it. But that is not the only reason. Let me list a few features that I think a pragraming language shares with a foreign language.
- You can quickly learn it if you have a good reason: having problem to solve, wanting to communicate with people in that language, etc.
- In any cases you have to know a bit of basic grammars to begin with.
- Both needs lots of practices and actual usages.
- Reading book could be helpful, but it is not always the answer: you should listen, speak, read, and write that language constantly.
Therefore, in case of learning a new language, I think we should not give to much attention to reading things: in the end, you should write code and make a program with the language. At the same time, reading could be essential, especially when you have absolutely zero knowledge or you are stuck in a certain level of fluency.
How would I start learning a new language from now on?
If I would start learning a new language, I would probably do the following:
Start with a simple documentation or tutorial covering basic grammars of the language.
Do some exercises: making a simple CLI application, or writing a simple game. You could either do some coding exercises such as Leetcode, Codewars, or Exercism.
If you feel comfortable with writing the new language, grab a project tutorial. It depends on your interest, the main usage of the language, etc. For example, I would write a web backend in Go or Node.js.
Now you build your own stuff, literally your own portfolio.
Repeat 3 and 4.
But most of all, in my humble opinion, you will be better off if you have a very good reason for learning the language. I've heard numerous cases in which a person can learn a foreign language blazingly fast if one has own lover using that language. Analogously, if you have a concrete and specific purpose of learning the language, I think you can very quickly learn it, like building your own website or publishing your own game.
Summary
It was my mistake that I thought I could master Rust simply by reading the Book. It was completely wrong. I should have written at least one or two simple games or any application on the way of reading it.
Now I have learned this simple truth the hard way, I could be faster in learning new programming languages. However, it may not only apply to learning programming languages. It could be anything in real life, because you learn it for actually using it.
Top comments (3)
It's true. Learning a language isn't solely achieved through theoretical knowledge; it requires practical application. I learn ad foklows: First, I'll quickly go through all the documentation. Then, I'll start writing whatever comes to mind. And if I don't undersrand something, I go back to the documentation.
Thanks for the good point! Actually this is the first time I had decided to learn a new language without any external pressures(like jobs, univ courses, etc.) so I had to learn this lesson the hard way haha.
In my opinion this is the best way to learn a new programming language.