4 steps I use to learn a new programming language.

Kent Fenwick
May 25, 2020 · 5 min read

Step 1. Buy a physical book of a language or framework you want to learn.

Step 2. Set a timer and make sure that you read for at least 10mins a day.

Step 3. Read with a purpose.

Step 4. Write out all code in the book by hand and make sure it runs.

Sitting outside the Eaton Center on cool August day I tore through the first few chapters of The Pragmatic Programmer. I was in 2nd year University and wanted to be a doctor. I had taken bio-medical computing at Queen’s University to differentiate myself from the crowd and somewhere in all the Java and C, I had started falling in love in programming, but I hadn’t found my muse, until that day.

Something about Dave and Andy’s writing made sense. Software was a skill and with deliberate practice, good principles, tested patterns and the right mindset, I could be become a master. I was hooked. Not sure if it was in the book itself, or an interview, but somewhere I remember them saying to write out the code samples when reading a book about programming. No copy and pasting.

Simple instructions are hard to follow. But back then, I was a journeyman, eager to learn and followed instructions well. It was a pain in the ass but I copied and pasted all lines from the original depot application in Agile Web Development with Rails. Maybe, I could just download the source and…

No. Dave and Andy said to write out the code samples, so do it.

So I did.

Simple instructions are hard to follow.

I learned Ruby and Rails and got pretty good at it.

As time went on, and the years went by, I found myself trying to learn new languages and I got sloppy. I would download the PDF version of a book and copy and paste the code samples. Or worse, I would download the Zip of the source that came with the book. Skim the code and structure of the app, build it, compile it, run it, and say to myself, “Ya, I can build this”. Or worse still, I would see the sample app that we were going to build in the book and say: “Psssh, I can do that” and skip over the code samples completely.

“Look how fast I am tearing through this book”, I would say while patting myself on the back, only to find myself lost and confused and abandoning the book.

Happened with Erlang.

Happened with Pheonix.

Happened with OpenGL.

Then came Go. I first saw Go when Rob Pike gave a talk at my lab in Grad School. A C-like language with a better syntax for more readable code, some memory management magic, and built-in parallelism. Sounded pretty good to me. That was a decade ago, maybe more.

I tried here and there but it never stuck. Then I found Black Hat Go and then the pandemic hit. I got the physical book, more by luck than by choice and as I started working through the examples, my framework from above kicked-in.

Step 1. Buy a physical book of a language or framework you want to learn.

Step 2. Set a timer and make sure that you read for at least 10mins a day.

Step 3. Read with a purpose.

Step 4. Write out all code in the book by hand and make sure it runs.

This is how I started learning:

  • Java Struts
  • Perl
  • Ruby
  • Python
  • Unix
  • Rails
  • Node

In all cases, I bought a book and followed those 4 steps. I am now at least an advanced beginner in most, proficient in some and a master in others.

Why a physical book?

Because they are rare. Your brain takes them more seriously.

“She’s actually reading a book made of paper… we should pay more attention” says your brain.

I also love the visceral sense of progress you can visualize each time you pick it up and look for your bookmark.

Why 10mins a day?

It’s hard for your brain to fight you if you say that you are going to do it for 10 mins a day. I have a full-time job and two incredible kids under the age of 7. If I can find 10mins you can too.

Sometimes you will read for hours, and sometimes you will struggle to hit 10 mins. Set small goals that can’t be challenged. This is a technique called Kaizen and this is my favourite book on the subject: The Spirit of Kaizen by Bob Maurer (audible, no affiliate link).

What is reading with a purpose?

Don’t learn just to learn. Learn with an end goal in mind.

Goals:

  • Ship a side project that needs that new language
  • Ship a side project in that new language or framework
  • Build a project you have already built before, like the depot app ;) that you can share with someone
  • Finish a school project
  • Find an open source project in that language you want to contribute to
  • Work on a hobby project
  • Work on project you need to get done for work.

You need to apply what you are learning as you are learning for it to stick. Don’t get stuck in the trap of reading to fill your library. Read to create an actionable outcome in the world.

I am reading Black Hat Go so that I can try and write a script to hack one of my own Rails sites just to say that I can. I have never done that before and to me, it’s like magic. I want to get a peek for what is behind the veil.

Your goals are personal and can change. But start with the end in mind.

Why write out all examples in the book and make them run?

Writing out code slows down your mind. You can read faster than you can type, so by having to copy the text into your editor forces your brain to slow down. As you are writing you ask yourself questions.

“Why does Go use brackets and strings when importing libraries? Are these arrays or something?”

“What the hell is :=, I wonder why they chose that symbol? Does that come from Haskell or was it Prolog? Is Go a functional language?”

“I wonder if I will become so good at hacking that I get targeted by the NSA, even as a Canadian, and they make Enemy of the State 2 based on my life.”

Making the examples you write down actually run forces you to get comfortable with the tools of the language and framework. When it comes time to start working on your project, you will feel more practiced.

So there you have it. If you have been trying to learn a new language and find that your computer is full of PDFs, or Kindle books that you never actually read or worse, you did read but the information didn’t stick, give this method a try.

Kent Fenwick

Written by

VP of Growth @clearbanc. I help companies grow. At the intersection of marketing, software development and product.

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +799K followers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store