Fluent Programming

Learning a language is the same whether it’s natural or artificial.

Photo by Kevin Ku on Unsplash

My greatest love has always been language. I picked up German as a child, then Spanish. I taught myself Japanese and Mandarin. Then Sanskrit, Ancient Greek, Swahili, siSwati, Malay, Bahasa Melayu. In graduate school, I learned Czech.

I don’t think I have any special genius for language. It’s something that anyone can learn and apply. And it lets me pick up programming languages even more rapidly than I pick up natural ones.

Python as a second language

One of the hardest parts about learning programming and machine learning is attempting to keep up with the state of the art. These fields encompass mathematics, computer science, information theory, philosophy, systems theory, business, psychology, data pipelines, DevOps, and the domain knowledge of whichever field you work in. The technologies — even the languages themselves — are constantly evolving. Staying current feels like drinking from a fire hose.

To meet the challenge of constant and rapid self-improvement, I’ve drawn on my history with language:

Love your subject, immerse yourself in it, and create a rich context to apply your new knowledge.

Photo by Hannah Wright on Unsplash

Love

Think of a time that you fell in love. The object of your affections was the most fascinating thing in your world. You wanted to know every detail about them; they intruded on your thoughts; you couldn’t stop gushing about them to anyone who would listen.

I have been infatuated with every language I’ve ever studied. I love every irregular idiom and quirk. Memorizing irregular verbs and learning syntactic structures isn’t tedium, because it happens in the course of discovery.

There is more beauty in a c compiler flag or a python traceback than you could imagine unless you let yourself fall head over heels for the language itself.

Let yourself love with wild abandon.

Immersion

Pretend you know what you’re doing before you know what you’re doing.

The ‘Fluent in Three Months’ method of language learning suggests some of the following techniques for rapid ‘language hacking’:

Think in your target language

Listen to music and compare the English and target-language versions of a song

Learn cultural details

Google for unknown vocabulary when needed/when you wonder

Create mnemonics

Schedule speaking lessons

Make vocabulary cheat sheets

Read news in your target language and try to get the gist of it paragraph by paragraph

You can’t map these all literally to programming, but you can get close:

Think about how you’d translate algorithms into code

Compare a program in a language you know to the same program in one you want to learn

Learn “cultural” details like the history of the language and its development community

Google for unknown syntax when needed/when you wonder

Create mnemonics

Pair program with a friend who knows the language

Make cheat sheets for functions and common patterns

Read source code in the target language and try to get the gist of it function by function

When you start before you’re ready, you will write a lot of code that doesn’t quite work. But errors aren’t something to fear; they’re something to embrace. We learn faster from our mistakes than from getting things right — so fast that it bypasses conscious thought. Error messages aren’t to be cursed — they’re instant feedback for reinforcement learning.

Photo by Tim Mossholder on Unsplash

Context

Context, not memorization, is the key to learning and making the knowledge stick. It won’t do to just read a tutorial in Java, then never program a single thing in it.

Make a project. Not a big one; something silly and small. Do you need a random number generator in c? A bash script to clean up your directories? A Python program that downloads PDFs for you? If you make a mini-project in the language you’re learning, you will go from passively absorbing it to actively recombining it into new, useful expressions.

Just like you learned to speak.

Citations:

Why We Struggle Learning Languages, Gabriel Wyner

Study Reveals Why We Learn from Mistakes, Live Science, Jeanna Bryner

Resources:

History and Evolution of Programming Languages — a primer on the diachronic development of computer languages

The Sieve of Eratosthenes in Any Programming Language — implementations of the famous algorithm in many different languages

Pair Program with Me — remote pair programming resources

OpenHack — a meetup for programmers to work together on anything