DEV Community

Madeline
Madeline

Posted on

Studying a programming language: tips from a former language teacher

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.

Step 5+:
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.

Bonus:
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.

Postscript
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.

Top comments (8)

Collapse
 
ronnewcomb profile image
Ron Newcomb

"The best way to improve ones coding skills is to read other people's code,"

Is this actually true? I learned from reading a manual on BASIC and just trying stuff out. I kinda 'felt' my way around how stuff worked. I still believe the best way to learn is to "play" with it, hands-on.

Collapse
 
marydee2001 profile image
Mary Dee

But you have to familiarise yourself with the language first before you can starting playing with it!

I'm a language teacher and I usually suggest my students listen to the target language as much as possible to become familiar with the rhythm and stress, as well as vocab. Obviously you can't listen to code so, per Madeline's post, the next best thing is to read it. :)

Collapse
 
ronnewcomb profile image
Ron Newcomb

Yeah but programming languages aren't actual languages. They're just pseudo mathematical notation. I can't imagine learning integrals by studying someone's derivation of L'Hopital's rule.

Thread Thread
 
marydee2001 profile image
Mary Dee

Why not? No one is saying that learning programming and learning French are identical, but there are similar principles which can be applied.

In English, the spelling of 'night' and the pronunciation difference between 'contract' and 'contracted' makes no obvious sense*. You just have to learn them. Same with spelling: 'i before e except after c', 'q must always follow u' etc. The point is that you look for rules and learn how they're applied and you start to see patterns in how a language works.

I don't think it's a coincidence that A LOT of my higher level students are programmers, and since I began learning tech many of the people I have spoken with online have a background in languages and linguistics.

*The reasons are historic rather than linguistic.

Collapse
 
madeline_pc profile image
Madeline

It's absolutely true that playing around with code yourself is essential to learning how to code. Obviously you are not going to become a great programmer if you only read other people's code but don't write any yourself.

My little quotation is an example of some advice that I've often heard around the internet, and I think that it is good advice. It helps to fill a gap that beginners face after they learn the basics and aren't sure what to try next. I think that both methods are useful. You need to learn by example and try out your own ideas. And of course, find what works best for you, because everyone's learning strategies will be different.

Collapse
 
ashwinsharmap profile image
Ashwin Sharma P • Edited

Well written will help many people.

Collapse
 
madeline_pc profile image
Madeline

Thank you! I am glad you found it useful. :)

Collapse
 
muratkemaldar profile image
Murat Kemaldar • Edited

Great! Reminds me of my own article I wrote in 2018: "Learning to code by writing code poems"

smashingmagazine.com/2018/07/writi...