Programming Concepts: How to Make Them Stick
Please note: The following technique is not for everyone. It can be of tremendous help for a visual learner like myself, but it’s not meant to replace any study method that already works for you. If you find however that traditional study methods aren’t really your thing — feel free to read on.
When we’re learning something new — particularly something as abstract as programming — we’re often going to bump up against unfamiliar concepts that are quite difficult to remember. Take for example the Symbol#to_proc
method I learned from Launch School’s Ruby course RB130:
The Symbol#to_proc
method is not exactly a straight-forward concept to grasp. Consider the code block below:
[1, 2, 3].map(&:to_s)
=> ["1", "2", "3"]
If we were to break down how (&:to_s)
works, it would go something like this:
- Ruby first looks to see if the object behind
&
is aProc
Object. - If it is a
Proc
object,&
converts the proc into a block. The block can then be passed into theArray#map
method as an argument and be executed. - If the object isn’t a
Proc
, Ruby tries to call the#to_proc
method on the object. :to_s
is not aProc
— it’s aSymbol
, which happens to have it’s ownSymbol#to_proc
method.- The
Symbol#to_proc
method converts the Symbol:to_s
into aProc
object for you. &
can now convert the newProc
object into a block and the methodArray#map
can finally execute the block.
Phew! It’s a bit confusing isn’t it? How might we go about remembering all the intricacies of these steps — in that order?
Well, we could try the brute force approach by applying rote learning techniques — repeating the concept over and over in our heads until one day it sticks. This does work of course — but it’s not necessarily the most effective way of memorizing how our Symbol#to_proc
method works. At least not by itself.
According to neuroscientist John Medina, pictures can supercharge our ability to recall information:
“Text and oral presentations are not just less efficient than pictures for retaining certain types of information; they are way less efficient. If information is presented orally, people remember about 10 percent, tested 72 hours after exposure. That goes up to 65 percent if you add a picture.”
65 percent?! Can you imagine how this impacts our ability to memorize all kinds of complex programming concepts?
Medina goes onto explain: “One of the reasons that text is less capable than pictures is that the brain sees words as lots of tiny pictures.”
This idea of pictures supercharging text is nothing new. It’s why movies, animations and comics are so engaging. It’s why really great storytelling stays with us; because we form pictures in our heads of what’s happening. This is “learning by association” in action — using pictures to associate more complex ideas. Could this be applied to complicated programming concepts too? And if so, how do we do it?
The answer here lies in memory master Kevin Horsley’s book: Unlimited Memory. Horsley indicates that we can use our creativity and imagination to associate easy-to-remember pictures with abstract concepts.
Let me show you one way we could do this using our Symbol#to_proc
method.
First, lets think about what’s happening here. How can we tell a story about this sequence of steps?
Perhaps we could start off by creating some memorable characters that interact with each other. Let’s see… we could have a ruby, A proc object, a block, a symbol, an & and the Symbol#to_proc
method:
Now “&” is already abstract in nature and therefore less memorable for our brain to hold onto, so I’ve swapped it out for an “ant”. They don’t sound too different from each other and it’ll help make the concept stick better. A method is also pretty abstract, so in my mind a method conjures up the image of a cog in a machine. A proc is also another hard-to-grasp concept so I thought of a fiery rock — a pyro rock (or a proc!). The rest of the characters should be self explanatory.
Now we can explain how the steps work in the Symbol#to_proc
method:
- Ruby will first look to see if the object behind
&
(ant) is aProc
object. - If it is, the
&
(ant) converts theProc
into… - …a block!
4. If the object isn’t a Proc
— in this case its a Symbol
— Ruby calls the Symbol#to_proc
method.
5. Once called, the Symbol#to_proc
method will then convert the Symbol
…
6. …into a Proc
object for us!
7. The newly created Proc
object now sits behind the &
(ant).
8. Now&
(ant) can finally convert it into…
9. …a block, ready to be executed!
And there we have it! Granted, It’s a completely different way of memorizing that involves a little bit of creativity on our end, but the payoff is huge. When we combine wacky characters with a story-telling component, we form strong, memorable mental pictures of how tricky concepts work.
I understand not everyone is comfortable with drawing pictures — and that’s perfectly okay. Horsley explains you can use Clipart instead of drawings. You can even write down your stories if you wish. The point here is that you can make hard-to-grasp concepts 65% more retainable with pictures than just plain text alone. And for anyone that’s ever wanted to learn something well — this is terrific news.