« 20% and Open Doors | Main | Lessons on Active Learning »

Analogies in the Classroom

By Dave Reed

I don't know about you, but when I teach I am constantly using analogies to relate computing concepts to real-world experiences the students are familiar with. Some of these are pretty standard and well known among CS teachers.

For example, when I want to make the distinction between classes and objects, I relate the class to a blueprint for a house and objects as particular houses built using that blueprint. Similarly, I relate a class variable to a safety deposit box that all instances of the class have a key to.

Sometimes my analogies border on the bizarre. For example, in my programming languages class this week I compared different memory management schemes to squeezing toothpaste out of a tube. Most people just squeeze the tube in the middle. This is analogous to a garbage collection approach: it is fast and usually produces toothpaste, but occasionally you use up the paste near the top and have to take the time to flatten it out (i.e., perform garbage collection). For the brand of toothpaste I use, there are instructions on the tube (yes, an algorithm for dispensing toothpaste) that tell you to squeeze from the bottom and roll up the tube as you go. This is analogous to a reference count approach: it takes a little longer, but it ensures that toothpaste will come out as long as any is left in the tube.

What analogies do you use when you teach? Which ones work particularly well? Which ones sounded good in theory but flopped in practice? Inquiring minds want to know.

Dave Reed
CSTA Board of Directors


I really like that toothpaste one! Very memorable!

Some analogies I use:

Hard Drive:RAM :: File Cabinet:Desk
Constructors:Life Givers
Mutators:TMNT (Teenage Mutant Ninja Turtles)
Accessors:Doctors XRay Machine

Class Interfaces:Instructions/Requirements/Rules

That's all I can think of off the top of my head, though I know I use many more.

It's an obvious one, but... the internet is like the telephone network. Despite being an obvious parallel, it serves as a useful mapping of prior knowledge for novices.

wired computer: wired handset
wireless computer: wireless handset
ISP: phone company
DNS: phonebook
DNS lookup: directory assistance
Reverse DNS: reverse directory lookup
IP address: phone number (one computer can have multiple IP addresses and one house/person can have multiple phone numbers; one IP address might be load balanced to multiple computers and one phone number might ring multiple phones)
Ports: extensions
LAN: PBX/internal company phone system
RJ45: RJ11
DoS: busy signal
Collision: party line in use by more than one person
Multicast: conference call
Router/Switch: switchboard

and so on.

Borrowed from Henry Neeman (UOklahoma)... jigsaw puzzles and parallel processing. (sorry if I don't do this justice)

puzzle: problem space
box of pieces: shared memory/storage
person working on puzzle: CPU/core (multiple people == multicore)
when two people reach into the box at the same time: resource contention
when you separate out a portion of the pieces ("you find the edges"/"you take this quadrant"): divide/parallelization
when you knit together solved parts of the puzzle: combine
puzzles that have well defined areas: easily parallelizable problems

...and all of the implied network, architecture, resource, overhead, etc. issues that obtain.

On net neutrality: Consider the case where Panasonic brand TVs are the only sets you can legally buy in your town/state/country. Panasonic decides to buy ABC and systematically begins adding static to all channels except ABC stations, and builds into their TVs automatic DVR of all ABC stations, but blocks DVR of any other stations.

Not so far fetched, when Comcast buys NBC Universal or the Advanced Access Content System (AACS)/HDMI specification prohibits composite out. [http://hardware.slashdot.org/story/10/02/19/1936209/2010-mdash-the-Year-AACS-and-HDMI-Kill-Off-HD-Component-Video]

Great examples of analogy! I really like it!
Recently I started posting interestnig analogies I found on the web on blog.ygolana.com. I thought it could be a good idea to create a place where people can help each other to find useful analogies so I created a simple site (www.ygolana.com) Check it out!

Lol, I like the toothpaste example. To teach I like to give the analogy of a jar, like you pour water [knowledge] into the soil, [student's brain], which in turns becomes fertile... That's learning in action!

That's a really good approach. You say it sounds bizarre, but I think the toothpaste analagy is a really good one. I've just completed an undergraduate degree in computing, and I think a lot of professors struggled to either convey things well, or spark any interest in some of the subjects. Let's face it, computing can be a dry subject, so anything to make it more manageable to comprehend is very very welcome!

You have a very personal and specific method of teaching your students. It is obvious that you love what you do, hence you came up with this kind of arrangement. If you believe that the method described helps kids then it is all for the best I think.

When I was in school, or I guess learning anything I found/find analogies to be the best way to learn new concepts. Obviously they can't always be applied but they do come in handy.

Hi Dave. Here are a few analogies that I use in teaching introductory Java..

indeterminate loop situation...a carpenter hammering a nail into a board. It may take one swing, three swings, or more depending on the hardness of the wood, the length of the nail, the weight of the hammer, etc.

Determinate loop situation: your high school phys.ed. teacher tells you to "drop and give me 20 push-ups!".

Methods being placed on the call stack: a method is like a plate that is put on the stack of plates you find at the end of the buffet table. As more calls are made, more plates are placed on the stack. When the top most method (plate) finishes its code, it is popped off the stack.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)