by Steven Gilbert

Use the Zeigarnik Effect to learn to code faster

The Zeigarnik effect can help you learn to code faster. First I’ll explain what this concept is. Then I’ll give you a practical way you can apply it to your learning.

What is the Zeigarnik Effect?

It’s 9:00pm. You’re learning JavaScript. You sit down at your desk. You open up your laptop and fire up your code editor. You’re working on freeCodeCamp’s Wikipedia Viewer project.

You code for some time, then take a detour and click into your browser to read a Mozilla Developer Network article about Cross-Origin Resource Sharing (CORS), because you’d like to learn about cross-domain Ajax requests.

The going is good. The more you read the Mozilla article about CORS, the better you feel like you understand it.

It’s getting late. It’s almost time to hit the hay.

What do you do next? Do you:

A) leave the article unfinished and come back to it the next morning?

or

B) finish reading the article to completion?

The Zeigarnik effect would have you choose (A) and not complete the article before taking a break.

Why?

Because the Zeigarnik effect says that “interrupted tasks are better remembered than completed ones.”

As humans, we have a craving for closure, which is activated when an issue is left unsettled. Think of the gradual revelations of detective novels — or of getting off the phone with a loved one after an unresolved argument. It’s this tension — created by a craving for closure — that helps us more effectively remember the unfinished task.

So if you’re an enterprising developer, you might consider applying the Zeigarnik Effect as you go about learning new tools and diving deeper and deeper into software development. Because — given the same amount of time with the material — the Zeigarnik Effect might help you better and faster remember these programming concepts.

Here is one idea for how you can leverage the Zeigarnik effect while you learn to code.

Pro-Tip: Leave a piece of code unfinished “when the going is good” and come back to it

You’re working on one of freeCodeCamp’s algorithm challenges. You’ve wrapped your head around the problem. You’ve jotted down some notes and pseudo-code on paper. And you’ve mapped out a high-level plan for how you’ll write the algorithm.

You start converting your thoughts into code. You code. Then you code some more. The going is good, and you begin to feel a tingle of dopamine being released in anticipation of one of freeCodeCamp’s challenge completion rewards, a message of positive reinforcement:

Now stop. Before you complete the challenge. Stop.

Deliberately decide to stop coding. And walk away from the computer and do something else.

“But I’m almost done!” you say.

The idea is that if you interrupt yourself in the middle of coding, you not only might improve your memory of those concepts you were practicing — you strengthen your motivation to return to freeCodeCamp and finish the challenge.

The craving for closure will be too strong a pull to keep you away from your computer for long. And when you do return, you’ll be back with a vengeance.

Again, by using the Zeigarnik Effect, you’ll 1) better remember the programming concepts the algorithm challenge was testing, and 2) have created an incentive to return to your text editor.

And doubly productive.

A double-barreled win.

The Zeigarnik Effect in action

Lately I’ve been on a binge-reading of Roald Dahl books and short stories, because Roald Dahl is an amazing author. And he had this to say in an interview, which sounds awfully similar to a Zeigarnik effect-type strategy:

I never come back to a blank page; I always finish about halfway through. To be confronted with a blank page is not very nice. But Hemingway, a great American writer, taught me the finest trick when you are doing a long book, which is, he simply said in his own words, “When you are going good, stop writing.
And that means that if everything’s going well and you know exactly where the end of the chapter’s going to go and you know just what the people are going to do, you don’t go on writing and writing and writing until you come to the end of it, because when you do, then you say, well, where am I going to go next? And you get up and you walk away and you don’t want to come back because you don’t know where you want to go.
But if you stop when you are going good, as Hemingway said…then you know what you are going to say next. You make yourself stop, put your pencil down and everything, and you walk away. And you can’t wait to get back because you know what you want to say next and that’s lovely and you have to try and do that. Every time, every day all the way through the year.
If you stop when you are stuck, then you are in trouble!”

You can listen to Roald Dahl’s full interview here.

Writing fiction and software development are more similar than you might think. Both are intensely creative pursuits. If stopping when the going is good helped two legendary writers produce some of the finest writing the world has seen, it can help you gear up your coding skills to produce some of the most useful software around, too.

What are some other ways developers can apply the Zeigarnik Effect to get better at coding? Leave your ideas below.

And if you have questions, you can tweet me at @gilbertginsberg or find me at GilbertIndex. Thanks for reading!