I have been fascinated by studying languages since I was 6. I majored in Classics and Ancient Mediterranean Studies (which was the study of Ancient Greek and Latin texts) in college, and then taught Latin online for two years.
Since I started studying code, I have begun to adapt some of my natural language learning strategies to this area. Here are some tips on studying a programming language, from a language teacher's perspective.
"The best way to improve ones coding skills is to read other people's code," is an advice tidbit you will often encounter in the coding community. Much like in language learning, we know that the best way to learn to speak is to listen, and then practice, practice, practice.
But when faced with unfamiliar concepts in someone else's code, how do you actually get from clueless panicked scanning the code to understanding it enough to learn from it?
This is the awkward post-beginner/intermediate stage of learning a new language. You know the syntax. You can form some simple sentences. Maybe you can even express a few thoughts in your own words. But when you look at someone else's writing, you feel like you haven't even studied the language at all!
Here are some ideas that I've adapted from my experience with language study that will hopefully help bridge this gap.
Step 1: Read through without looking anything up
Read through the whole code snippet once for familiarity and to absorb the structure. Let your mind grasp the things you do understand, but don't worry too much about things that are unfamiliar. Notice bare bones control flow items like "Oh, the author is defining a function. Oh, here the author is calling that function." You are not skimming, but you are also not freaking out about everything you don't understand.
Step 2: Read through again taking notes of unfamiliar concepts
Read through the code snippet a second time and start writing down things you don't understand, but don't look anything up yet! This will provide your roadmap of discovery for step three.
Step 3: Research unfamiliar concepts
Look up unfamiliar concepts one at a time and write down your findings. This step might also include reviewing some things you have studied previously but need a refresher on. It's up to you how deeply you want to understand new topics you come across. Try to find a balance between vague familiarity and total understanding. You want to understand what the code is doing without falling into the trap of endless rabbit holes throughout the internet. A good starting point is to pick one or two concepts that are most important to you to understand well, and then let some of the other ones slide until next time. If you try to understand everything exhaustively you might slow down your progress.
Step 4: Put it all together
Start at the beginning of the code snippet and read through with your newfound knowledge to see if you now understand what the code is doing. Refer to your notes where necessary. Try explaining what the code is doing out loud if you get stuck, as if you are teaching another person.
Rinse and repeat for total fluency.
Things to keep in mind:
It's okay if this process takes you a while. You can't rush learning. Knowledge compounds over time. What you study today will help you learn tomorrow, even if you don't feel like you're getting it today.
In learning any language, using the new vocabulary is the goal, so you want to make sure you practice your new vocabulary in the following days by reviewing your notes. Then you should strive to use your new found vocabulary in your own code. Try to use one or two features to start out with. Reproduction is the final step in understanding, so being able to see these new elements in your own code will help boost your confidence that you are really learning.
The goal is not to copy and paste here. The goal is to understand and internalize the concepts that the author used and then make them your own.
This is basically the exact process that I followed in a language learning context to approach fluency. I would read through a passage once for familiarity, read through a second time and write down things I didn't know, look up those items, go back and read it again while putting them back in. Then I would come back to the passage the next day and try to read through without my notes to see if I could understand it better than the day before. It is tedious at first, but once you begin to enjoy the learning process, quite rewarding.