The Right Way to Learn to Program

Amy M Haddad
Level Up Coding
Published in
5 min readMar 18, 2021

--

There’s so much new and dense technical information coming at you when you begin learning to program. How do you learn and retain it all?

That’s a question I’ve asked myself many times on my own programming journey. In an attempt to find an answer, I’ve experimented with many learning tactics along the way. However one stands out among the rest. I call it the apply first, study second approach.

If you’re looking for an efficient and effective way to learn to program, I suggest you give it a try.

Learning in Action

Apply first, study second means attempt the problem first. The aim isn’t to get the correct solution, though you may. Rather, it’s to find the roadblock. Then, consult a course or book, for example, to get yourself unstuck and to take a deeper dive into the particular trouble spot.

Say you attempt a problem that asks you to use a list comprehension. You make some progress but get stuck when you have to use a conditional. Trying the problem first brings awareness to the roadblock: using a conditional in a list comprehension. You’ve narrowed your focus to one thing, now nail that one thing.

And you will. Because you attempted the problem first, you’ll reference a resource with purpose. You’ve got a particular question in mind: how do I use a conditional in a list comprehension? So instead of trying to learn everything, or re-learning things you already know, you’ll focus on the one lecture that talks about conditionals.

After you get what you need, then apply it to the problem at hand. In other words, apply your newfound knowledge.

If you get stuck again, follow this same iterative process:

  • Clarify your question (e.g., “why won’t this while loop terminate?”).
  • Find a resource and focus on answering your question.
  • Apply what you learned to the problem at hand.

I admit, watching video tutorials is easier. However, easier isn’t better when it comes to learning. “We’re easily seduced into believing that learning is better when it’s easier,” argue the authors of the book, Make It Stick, “but the research shows the opposite: when the mind has to work, learning sticks better.”

Apply first, study second may feel a bit uncomfortable. It may seem like you’re inching along at first. But fast-forward a week or two and you’ll be amazed by how much you’ve learned — and retained. There are key reasons for this.

Learn It and Retain It

First, the information you obtain from a book or course is far more meaningful when you try the problem first. That’s because your mind is on alert.

It’s like when you buy a new blue car, and “suddenly” you see a bunch of blue cars on the road. Likewise, when you try first, the problem you got stuck on is in the forefront of your mind as you zone in on the content of the lecture. Plus, the information you pick up will resonate more because you’ve got a particular situation to apply it to.

Another reason why you’ll learn and retain more with apply first, study second is because we tend to remember the times that we struggle. (Remember how hard that 10-mile run was? Remember how much effort you put into writing your first twenty-plus page research paper?)

“When you’re asked to struggle with solving a problem before being shown how to solve it,” explains Make It Stick, “the subsequent solution is better learned and more durably remembered…when you’re then shown the solution, a light goes on.”

Third, you’ll build what I call your “programmer’s intuition.” That means, you’ll begin to spot patterns and make connections as you bend existing knowledge in new and different ways, simply by attempting the problem first.

The Non-School Approach

Apply first, study second runs counter to how most of us learned in school: sit through a lecture, then do your homework. This outdated approach has been championed by many learning platforms and bootcamps: cycle through an endless number of videos. Then, (maybe) there’s a practice problem or project at the end.

I fell victim to this approach when I began to program, and found it to be woefully ineffective.

We think we’re making progress because we cycle through tons of lectures. We think we’re learning because the expert makes the process look so easy. So we think we’ve “got it.”

But it’s often an illusion. We don’t realize it’s an illusion until we’re faced with a situation that forces us to apply our knowledge, and then we’re completely stuck. It’s no wonder we get so frustrated by our programming progress: we pump in a ton of time to watching lectures, but we’re not retaining the information because we’re not actively applying it.

Watching a course from start to finish is no way to learn for this reason: the information doesn’t stick. “In very short order we lose something like 70 percent of what we’ve just heard or read,” Make It Stick points out.

Inundating ourselves with tons of information from the start isn’t beneficial. Yes, there’s a lot to learn. But you don’t need to know everything right now. Nor is it useful re-learn previously learned concepts

That said, it’s more effective and efficient to focus on the thing you need when you need it. And the way to find out what you need is by trying first: attempt the problem.

Make It Active

There’s an exception to this approach. Say a problem asks you to write a class, but you’re new to programming and have never written a class and know nothing about classes.

This is a situation when I’d recommend to learn just enough, then apply right away. By “just enough,” I mean get the big picture concepts and don’t get lost in the details. Then start the iterative apply first, study second approach: continue on with the problem and consult a resource if you get stuck.

The quicker you get to “doing,” the better the learning. So make your learning active from the start with apply first, study second. Aim to spend more time actively doing the thing you want to get better at. After all, cooks cook. Writers write. Programmers program.

Programmer and writer: amymhaddad.com | programmerspyramid.com | I tweet about programming, learning, and productivity @amymhaddad

Originally published on amymhaddad.com.

--

--