3 Methods to Actually Remember What You Learn in Coding Tutorials
When you first deal with a new topic, coding tutorials are great. Rather than continually grasping at straws and struggling your way through a project, the instructor conveniently shortcuts all this pain - all you have to do is follow along.
After several hours of painstaking copying, you have a working app - an app that you built... right? Something to be proud of!
But then the thought creeps in... did you build it?
You couldn't do it again (at least on your own). You have no idea how it was built. After all that work, have you really learned anything?...
Let's be honest: you probably didn't learn much - but there is gold in those tutorials. I've espoused the benefits of copying people to learn code, and that's what you've just been doing.
The reason nothing is sticking is that when you're busy copying the instructor, there's no space to engage with the content. It's not your fault, that's just the reality of being human.
The real value is in what you do after the tutorial.
To make the content stick, you need to spend some time working with the code, and transforming it in a meaningful way. Below are three effective strategies about how to do that:
#3: Refactor the code
This is the most direct way of engaging with the tutorial content - go through the code and look for ways to change it.
The questions you want to ask yourself are:
- Is there some other way of structuring the code? (Different functions, classes, etc.)
- Are there better names for things?
- Are there any other language features I could use to replace this? (Arrow functions, Ternary statements, etc.)
For the sake of learning, these changes do not need to be improvements - you're only trying to engage with the code. In fact, if you can't think of a way to improve the code, look for ways to make it worse (while making sure it still works).
This approach is the best for learning how the tutorial code works and has the lowest barrier for entry. It is also the easiest (but least effective) of these methods, as it doesn't require you to solve many new problems.
#2: Change, or add a new feature
For my money, this is my favourite way of learning from a tutorial. Take the code you have, and use it as the basis for a practice project.
In a todo-list app (because there's no shortage of tutorials for those...), you could:
- Add due dates for tasks
- Add sub-tasks
- Add comments to tasks
- Add a "Clear all" button
All of these are valuable opportunities to practice the concepts you've learned and to engage with the tutorial.
This approach is best for practising building features (and projects) from scratch and is the approach I'd recommend most of the time.
The downside is you may not spend much time directly working on what the tutorial was trying to teach (but you'll still learn plenty!).
#1: Create a similar (but different) project
Of the methods I've outlined, this is probably the most difficult to get right, since it's hard to find the correct balance. Still, if you get it right, it can be an effective approach.
The goal is to create a project that is different from the tutorial but is similar enough that you're able to use the tutorial to help you.
For instance, you might use a Todo app tutorial to create a Notetaking or a Flash Card app.
This approach is the best way to practice the core principles that the tutorial is trying to teach. You'll continuously be readdressing and changing things to fit your new project.
The downside, as I said, is that it's challenging to strike the correct balance of "similar but different". It's easy to accidentally bite off more than you can chew.