Learning a programming language can be very enjoyable: it will stretch your skills and you will be able to create whatever you want with it. After all, programming languages are the basis for building software, creating something personal other people can interact with.
I love programming by itself: it’s a puzzle game to me. It’s mainly about logic, and logic is fun to mess around with!
A game you can create something with. Isn’t that super cool?
In this article, I will describe the process I used to learn the programming languages I know. I will try to answer these questions:
- How to learn properly a new programming language?
- What are the best resources to use?
- What mindset to have and tools to use?
- What are the other benefits of this learning methodology?
It doesn’t matter if you are a complete beginner or if you already know a programming language: the process is the same.
Come with me dear reader, let’s go to Programming Land where every variable, functions and classes live in peace and harmony.
The Prelude: an Environment Where you Can Focus
First of all, let’s be clear from the get go: learning a new programming language takes some time and efforts. Nothing impossible, but don’t expect something extremely easy which will bring you a lot of money and glory.
To learn something in general, you need to focus on the quality of your learning. If you try to push yourself too much, you won’t learn anything. If you watch TV while coding, you won’t learn that much either.
- A quiet place where you can focus solely on what you want to learn.
- A place which is inspiring for you. The best would be somewhere where you can’t be tempted to do something else.
- To choose your code editor / IDE. We want to learn a programming language, not finding the perfect tools. Don’t spend hours on it: just choose the most popular option. I definitely advise an editor with some sort of auto completion, it will help you a lot.
Now that we are setup, let’s get started.
The First Step: Learning and Understanding the Basics
The basics include:
- Code syntax
- The fundamentals of programming
The first is unique per programming language, the second can be applied to a lot of them.
Don’t be afraid by the fundamentals if you’re a beginner in programming in general: you will get them along the way.
Finding the Best Resource for the Job
To learn the syntax of a new language, the best method is to take a book and copy the code given as examples. It sounds dumb but it’s the most effective to me.
Reading a book is not enough: if you want to learn something, you need to learn actively. Reading is way too passive.
If your book is good enough, it will explain to you the basics of the language syntax, some general fundamentals with code snippets as examples. Copy these examples in your code editor and execute them.
Don’t try to understand everything in detail while reading the book, especially if you are a complete beginner. You can go back to it later. For now, the goal is to have a good and global idea about how the language works.
There are a lot of books out there which provide you some code with explanation. I personally really like the whole learn code the hard way collection. Don’t be afraid by the “hard” in the title: it indicates simply that it will teach you properly what you need to know, without shortcut. This is what we want.
For the folks who already have some experience, these books can be a bit boring at the beginning. However, it can as well teach you some fundamentals you didn’t know, or simply refresh some forgotten memories.
You might ask yourself: why a book? Why not following some articles on Internet? Or a series of Youtube video? Simply because you never know the quality of the content you consume on the Internet. You don’t want to take wrong habits; it’s easy to learn inaccurate concepts and be totally confused by it later. Learning is easier than unlearning.
That’s why you should choose a book which is advised by the community of the language you want to learn. You need to be sure you can trust its teaching: you should ask around in forums, discussion groups what would be the best book. Positive book reviews on a website like goodreads can be a good indicator as well.
You want to avoid misconceptions, that is the fact that you know something which is only partially true or totally wrong.
Now, I have a little quiz for you. What’s the best way to learn from these very objective propositions?
- Focusing on your book on a regular basis, from 30 minutes to 2 hours maximum per session.
- Cramming 8 hours of study every two months, your belly full of RedBull, at 2am, when your procrastination can’t let you sleep anymore.
I have no partnership with RedBull and human attention is very short. Learning two hours straight is already challenging. That’s why you’re right, dear reader: take the first path.
You will learn tremendously faster that way. Learning will be more enjoyable, less stressful and less exhausting.
Take your time, be patient, and you will get there. Don’t forget: the most difficult is to begin. If you have some tendencies to procrastinate, like everybody else, try to open your book only for 10 minutes. Close it if after these 10 minutes you still don’t want to learn.
You will be surprised where this simple technique can lead you.
Personal Knowledge Assessments
Come back to the code you wrote from time to time, without the book this time. Ask yourself something along these lines:
- What did I learned the last time?
- What was the purpose of the examples and what the book tried to teach you?
- What does mean this specific syntax?
- What the purpose of this function?
- What is the output of this example?
This is meant for you to remember the fundamentals and the syntax of your new programming language: by trying to remember what you learned the last time and formulate it with your own words.
If you’re really motivated, you can even try to find some other solutions to output the same result.
When you write your code, don’t use too many comments! Try to understand the code as it is. It will, most of the time, give you enough information for you to find what was the purpose of it. Moreover, when you will be a rich and famous developer working for the Nasa, your colleagues won’t comment every single line of code they will write (I hope). They will expect you to understand the code as it is.
If you have no idea what you’ve written, that’s perfectly fine. Even if Yoda himself said the contrary, trying is the most important.
After your tried to remember what you learned the previous learning sessions, open your book and let these “aha! I remember now!” thoughts of victory blossom in your wonderful brain.
You can test yourself every week or every two days, it doesn’t matter. Simply have a study plan:
- Read the book
- Copy the code
- Test yourself, without the book, from time to time
- Go back to 1
You need to find your own pace: not too slow or your motivation will suffer, not too fast or you will feel exhausted and disgusted. Find a balance to keep your interest in your new programming language, that’s the most important!
The Second Step: Beginning a Side Project
When you’re half-way or about to finish your book, you can begin the second step of this plan to rule the Universe: beginning a side project.
Actually, you can begin it whenever you’re able to use the syntax of your new programming language without too many difficulties. Just try and adjust: if you can’t really build something because you need to Google every 2 minutes how to write this or that for 2 hours straight, you’re not ready yet.
If you’re totally bored with your book, if only opening it feels like a torture, if you have the worst nightmare about basically every page of it, it might be a subtle indicator that you need something a bit more concrete and creative. Hence, the side project!
What the benefit of a side project, you might ask? Very good question, dear reader. You see, learning the syntax and the fundamentals of a programming language is essential, but definitely not enough. Programming is about problem solving and you need to be able to solve all kinds of problem with your new language.
A side project with its roadblocks and difficulties is the best way to do so. Plus, it’s fun.
What Side Project can You Build?
I already wrote a series of articles about side projects:
- The first article is about the mindset to have to carry your side project through its end. Believe it or not, the mindset is the most important!
- The second article focus on the tools I’m using to follow this mindset.
If you need to remember only one thing from these articles, it would be the following: build something small! You don’t want to build the best application of the year and become rich, famous and unhappy. You want to learn a new language.
Your side project could be anything from a todo list app, a pomodoro app or a calculator. Even better: if you have some personal ideas which could be a fun small project, please proceed. It’s even better than picking random ideas on The Internet.
If you want to build something bigger afterward, feel free to do so. Go step by step, begin by something little and go bigger and bigger if it’s what you want. Keep in mind though that side projects are exponentially difficult to achieve bigger they grow.
The Best Way to Work on a Side Project
You need to know exactly what functionalities your side project will have. I will never say it enough: as few as possible, for the beginning, is the best. You can still add more on top later.
Then, follow these steps:
- Open your IDE / editor
- Choose the functionality you want to code
- Google is your friend when you’re stuck
- Hooray! Your functionality works
- Go back to 2
This is called an iterative process. Even if you’re wrong at the beginning, you will fix your mistakes and come closer to the achievement of your sweet project after each iteration.
Analysis paralysis can be your biggest enemy as a developer: don’t overthink and code something. Don’t try to find the perfection in these wonderful lines of code: we don’t care about that.
Don’t spend an awful amount of time searching the best tooling either. I would suggest not using any framework for your first side project. If you need some libraries, take the first one advises by the community (or first ranked by Google) and go for it. Even better: code it yourself if it’s not too long or too boring.
If you feel comfortable after a while, you should try to write some automated tests as well. It’s important to know how the language handle testing. Consider it as a bonus.
The Third Step: Show the World your New Talents
Share Your Code and Grow Your Credibility
If you’re a beginner in the fantastic development world full of unicorns, rainbows and mortal tar pits, you need to get a bit familiar with git. It’s basically a system which allow you to version and push all your code on an external server.
The how and the why of git are beyond the scope of this article. If you want me to speak about that, you can write a comment below. Don’t be shy! I like to hear about you, dear reader.
When it’s done, congratulation! You can now show your code to the whole world. This is especially useful if you’re planning to find your first job as a developer: you can show your fantastic side project to anybody who wants to see your new capabilities.
It’s even better than building a portfolio filled with emptiness!
That’s why a side project is important: it will teach you your new shiny programming language and it will improve your credibility as a developer. More code you will have on Github, more chances you will have to skip the boring and usual interview coding tests I personally hate.
How nice is that?
Get Feedback From Your Peers
All of that is very nice but there’s something important to keep in mind: working alone on a side project can teach you a lot of wrong things.
Even if you follow a serious and praised book, you can still misunderstand some concepts. You can as well be victim of illusion of competence, when you think you know something but you’re not able to use it or even to explain it. Not really useful, isn’t it?
Writing the code from your book and doing a side project can prevent you to fill your brain with nonsense, but there is still some risks.
That’s why I would advise you to show your code to a maximum of people. Go to Reddit, forums, Facebook groups, and ask for feedback. Negative ones are the best: they are never easy to handle, but they will teach you a lot, and that’s what we want.
If you know some experienced developers you can ask feedback from, it’s even better. It can be some developers you’re in contact with at work. You can go to developer meetup in your area. Having a mentor you know well and who can provide you personalized advice would be the best of the best.
Having feedback is great when it’s constructive. Don’t take into account pure criticism without any arguments or explanations. What you want is constructive feedback: the ones which are justified and which explain clearly your mistakes and the possible solutions to fix them.
Does This Method Really Work? How to Apply the Three Steps
This part is not only an ego-centered gabbling about me and how great I am (the about page of this blog is there for that), but more about giving you concrete examples.
How Did I Learn Development 20 years ago
When I was younger, I wanted to code video games. I loved playing them, but I had already these impulses to create stuff on a screen.
Therefore, my parents bought me a book to learn C for my birthday. I spent months on this book: I was already applying the three steps technique I just explained you, instinctively. I didn’t have Internet at that point, so I didn’t have the choice, and I’m very happy about that.
I read everything and copied most of the code while reading. The book taught me as well all the fundamentals of programming I needed, at a low level.
Halfway through the book, I began to code my first side project: a textual RPG where you could choose your race and your weapons to go on a text-based adventure, in the Windows terminal.
Even though I have now access to Youtube and basically every article or resources I want, it’s useless if I watch them or read them passively. I tried, I don’t remember anything most of the time. Learning and practicing goes hand in hand, one without the other doesn’t make sense.
Moreover, my book about C was very good to explain many fundamentals and emphasis the most important topics and details. That’s why today, when I need to learn a new language, I follow exactly the same method and I’m very careful to find the proven and praised resources to study with.
How Did I learn Golang in 2018
Let’s go back to a nearer past: one year ago, after 8 years as a PHP developer, I decided to learn a new programming language to extend my skills. I choose Golang for a lot of reasons. Again, if you want to know them, “comment below” and I will do as you say, master.
- First Step: One of my colleague advised me to read Go in Practice while copying all the code given as example. It’s what he did himself to learn the language.
- Second Step: Halfway trough the book, I began my first side project in Golang: testomatic.
- Third Step: I shared my code on the Golang google group and on the Golang subreddit. The sweet Golang community gave me valuable feedback which helped me understand the general Golang philosophy and best practices.
The result? I found a job in may 2018 as a full time Golang developer.
- Bonus step: after beginning my new job, I read Go in Action to understand the fundamentals and mechanics of the language better.
Since I track my time for a lot of things (but not everything), here are some metrics to give you an idea how much time I spent on the first and second steps. This is for your information only, you need to adjust your learning time depending on your own needs and motivation!
First step: going through Effective Go
- The y-axis are the number of Pomodoro I did each week.
- One Pomodoro is 25 minutes of focus learning.
As you can see, I began to read the book in January 2018 pretty slowly but consistently: this is the key to learn anything you want. The time I spent on it in March and April increased: this was the notice period from my position of PHP developer to Golang developer.
I wanted to be ready for my new job. The other reason: Golang is an interesting language, and I was looking forward to know more about the syntax in order to build something with it.
Second step: testomatic, my first side project in Golang
- The red line represent the amount of work I expected to do each week.
- The blue line is the amount of work I was really doing.
Again, you can see the same pattern: I began slowly but consistently, and then my motivation went through the roof in March and April.
This is a good example to underline that you don’t have to overwhelm yourself by planning 29 hours of learning a week to make through your side project: only 25 minutes a day can bring you unexpected results, when it’s done consistently.
You might notice that I never finished the book: since I began to work as a full time Golang developer with talented colleagues who were able to help me, I judged that I didn’t really need to. It’s perfectly fine: don’t put pressure on yourself to finish every single one of your books if you don’t feel the need to do so.
Moreover, you can always come back to unfinished books later.
Here’s a condensed version of the learning method described through this article:
- Step 1: find a well-known and rated book, follow it and write the code given as example.
- Step 2: half-way through the book (or when you feel ready), begin a small side project. If it’s something personal, it’s even better.
- Step 3: show your code to whoever can give you feedback. Having a mentor is the best!
If you need to remember something from this article, remember that: active learning is always better than passive learning.
I agree that copying code examples from a book and coding your own side project are more efforts than passively watching coding videos on Youtube. However, since you’re a (possible wannabe) developer, you should be able to enjoy it, at least most of the time.