madhadron

Learning programming

Last updated: June 1, 2020

Most advice on learning programming is poor

Do you know how to teach someone to walk or to read? (If you are an occupational therapist or trained teacher, just skip this, because you already know the difficulties of pedagogy.) Most people don’t because the skills needed to walk or to read have been ingrained to the point that they are invisible. Programming is similar. Pedagogy is hard.

I am not an expert at pedagogy, merely a dabbler with expert friends. I have learned enough to know what is invisible to me and to know what to look for.

Fundamental perspective

There is a kind of magic in the computer.

It doesn’t come from it being smart. A computer has all the intelligence of your shoe. It has a menu of simple instructions it can follow.

But it can do billions of those things a second. There is a saying in physics: more is different. A billion operations lets us paint an image on a screen that imitates the control panel of a specialized system. It lets us generate the sound of a piano or any other instrument.

More importantly, a billion operations can mechanically translate from abstractions suited to what we are thinking about into the simple instructions of the machine. And there is the magic. That simple menu of instructions explodes into a world of languages. If we can express our intentions precisely in a precise language, the computer can carry them out.

So, above all else, you must learn how to express your intentions precisely in a precise language. Start with one. Which one doesn’t matter as much as whether there is a good system of pedagogy to guide you through it.

Step 1 (~3 months)

Free Resources:

The two ‘How to Code’ courses are based on the book in the first link, but they elaborate the design recipes from the book further. All three use a free programming system called PLT Racket, which runs on Windows, macOS, and Linux.

A buffet of further steps

From here it becomes much less linear. These are all study approaches, but you also need to write your own software. It will be slow and torturous initially. You will look back later at your code and think, “How was I such an idiot?” The steps below will accelerate that, but you are learning a craft. You wouldn’t expect to be a virtuoso the first time you picked up a violin or to make perfect dovetails the first time you picked up a saw.

So, in no particular order:

Understand the basics of concurrency

Dealing with multiple things happening at once and communicating, blocking each other, locking and sharing resources has gone from an exotic topic for specialists to an everyday concern, so you might as well get used to the idea now. I highly recommend this fun programming game:

Learn ways of organizing your thoughts

After step 1 you should be able to produce simple programs in the programming language Scheme. Now you need to learn the various ways that people have learned to organize their thoughts in precise language. The fastest path is through the classic book Structure and Interpretation of Computer Programs.

Read and pastiche code

Read other people’s programs. You will need to learn some additional programming languages to do so, but you should start getting used to that. The first few programs in a new language will take forever as you look through tutorials, books, and references to figure out what each piece means. After that things will speed up. Once you have understood a new thing or a new idiom, write a small program of your own with it. In the art world this is called pastiche, and it’s an incredibly useful tool for internalizing knowhow.

Some code bases that you might profitably trawl:

Look for more from

There is much more to be written on how to approach reading source code. I have such an essay in my writing queue.

Habits and practices

We said that there’s magic in the machine, but it’s magic of more. More implies all kinds of chances for getting lost in your own confusion. People have been facing that confusion and trying to handle it since the start of this field. Some books worth reading on the subject:

After a couple of decades of programming there are parts of all three that I disagree with, and that’s normal (I’m known for being idiosyncratic). I still recommend them.

Learn to monitor and automate a operating system

It doesn’t matter if it’s Windows, Linux, or macOS. Whatever you’re using will work. They all have similar concepts, just exposed differently. Some tasks to learn:

You’ll need to learn the command language for each system. On Windows that’s PowerShell. On Linux, that’s bash. On macOS it could mean bash or it could mean AppleScript. One automates the lower levels, the other automates the UI. Oh, and learn how to do all of the tasks above from your command language as well as whatever GUI your operating system provides.

These skills pay off massively over time.

Computer science

Algorithms and data structures are the building blocks of programming. You don’t have to do this all at once. When you encounter a topic or a named algorithm in your code reading, or a problem when writing your own programs, stop and look for existing literature. There is a good chance that a couple days of study can save you weeks of work.

There is a giant literature of textbooks, courses, and research papers on this stuff. As a starting point, I suggest Skiena’s The Algorithm Design Manual.