[Edu-sig] Edu-sig Digest, Vol 39, Issue 2
John Posner
jjposner at snet.net
Mon Oct 2 18:14:38 CEST 2006
Kirby said:
> We say "reference" a lot when talking about a variable's relationship
> to a piece of memory. I'm thinking "handle" could be used more
> (optionally -- this is not an instruction) and we could even show a
> coffee cup (doesn't have to be coffee -- a mug) with two handles, when
> explaing how two (or more) variables may have the same "contents" (a
> feature, but also a source of bugs, confusions for beginners).
Picking a good metaphor, tailored to the pedagogical situation, is very
important: it provides the critical cognitive bridge from what the student
*already* knows to what you want the student to *learn*.
The best metaphor I've encountered for the concept of variable, as
implemented by Python, is John Zelle's. On page 34 of "Python Programming:
An Introduction to Computer Science", he says:
Assigning a variable is like putting one of those little yellow
sticky notes on the value and saying, "this is x."
Thinking "sticky note" makes it easy to teach students that:
* Even if "x" is already assigned to one value, you can assign it to another
value. (Take the note off the first value, and stick it onto the second
one.)
* In Python, any variable can be assigned to any value. (By contrast, some
languages have "colored sticky notes", and you can't stick a BLUE sticky
note on a RED value). John Z, do you take this angle in your book? I didn't
see it, but I confess I may have failed to look thoroughly enough for it!
* You can assign "x" and "y" (etc.) to the same value. (You can place any
number of sticky notes on the same value. A note is always attached to a
value -- a note is never attached to another note.)
* Jut what does the "del" statement actually do? (It removes one sticky note
from a value. If a value loses all its sticky notes, it becomes totally
*incommunicado* -- there's no way to get to the value.)
* What's a namespace? (A bunch of sticky notes.)
* etc., etc.
The coffee-cup-handle metaphor is certainly useful, but IMHO not quite as
spot-on as the sticky-note metaphor.
-John Posner
More information about the Edu-sig
mailing list