Stage 3 Talent

Analogies in Education: A Powerful Teaching Tool

Analogy is a powerful teaching tool. A good analogy helps learners create and organize mental structure. It makes learning personal and relevant, because it connects a new concept to a learner’s experience. A good analogy provides mental scaffolding. 

In physical and online classrooms, I’ve noticed five analogy principles. We’ll explore each using JavaScript functions as an example. 

It’s all analogy, so a good analogy is better than a bad one. 

Analogy is impossible to avoid. Even when we think we’re stating crisp, clean facts, analogy sneaks in. An instructor might describe JavaScript functions as “subroutines”. They’re not wrong, but a subroutine isn’t a concrete thing that perfectly illustrates a function. The concept of a subroutine is vague. It’s an analogy. Depending on your audience, it may not be a very good one. 

Another instructor might point out the similarities between mathematical functions and JavaScript functions. After all, what’s more factually pure than math? The relationship is intuitive. Unfortunately, “intuitive” here means “familiar”. If your learner isn’t familiar with math, the math function-to-JavaScript function relationship is just another bad analogy. 

Boiling it down to programming terms, we could define a function as a “named block of expressions and statements which is executed by listing the function’s name and providing arguments”. Again, that’s not necessarily wrong, but we haven’t successfully escaped analogy. For new programmers, blocks, expressions, and arguments are still fuzzy concepts. From their perspective, we’re building an analogy on top of concepts that are themselves half-formed analogies. 

Start general. 

Written lessons and first discussions should lead with an analogy that resonates with everyone in the course. It should sacrifice detail in hopes of a first intuition. 

For example, a JavaScript function is like brushing your teeth. It’s a series of steps that you do the same way every time (most of us) and something that you can “execute” at will. Normally, you brush your teeth in the morning, but you may also choose to brush your teeth after a garlicky meal. 

A function with parameters is like cooking dinner. The high-level steps are the same: prep, cook, serve, and tidy. But depending on the recipe, you end up with a different meal. 

Get specific. 

As you get to know your students, try analogies that are most relevant to small groups and individuals. The more personal an analogy, the better. A personal analogy creates connection and meaning. 

If there are musicians in your course, a function is like a song’s refrain. It’s the same set of musical instructions, which can be repeated at will. A refrain might accept a key signature argument since refrains are sometimes repeated in a different key. 

A cook might understand functions as sub-recipes. If the recipe on page 32 calls for 2 cups of bechamel, the bechamel recipe on page 112 is a function that can be executed when it’s needed. It can be executed from different recipes, which can be viewed as functions themselves. 

Knitting is just programming in fiber, so there’s bound to be a good function analogy for knitters. Do you know one? 

Recognize the limits. 

An analogy can never be the thing itself. If, after several rounds of analogy, the learner’s procedural mastery isn’t improving, try something else. Even if their mastery is improving, always teach from several angles. 

Provide many and varied examples. Ask students to make small changes. Share code that’s broken in an obvious way and ask them to fix it. Sometimes, all it takes is persistence and a debugger to grasp how functions are defined and data flows into and out of function calls. 

Watch out for damaging analogy. Rarely, an analogy can confuse a learner and leave them in a worse place than where they started. Read the room. If there’s confusion without progress or worse, a reversal of progress, disengage. Take a break. Try something else. 

Encourage analogy-making and trust the learner. 

The best analogies are the most relevant and personal. Encourage students to make their own. If you understand the topic, check that the analogy is consistent and sensible. If it’s not, nudge them in the right direction. Ask them to refine. 

If you don’t understand the topic, trust the learner. Encourage all students to explain their thinking to classmates and instructors. Then insist on civil feedback. 

Finally, if the student is making steady progress on their procedural mastery and their analogies don’t make sense, don’t sweat it. Mastery is an incredibly quirky and personal thing. My subjective experience of defining and executing functions is likely very different than yours, even though the result is the same. If the student can do the work, a perfect analogy isn’t required.