Analogy-based notional machines map from a programming context
to a context that is an analogy students are potentially familiar with.
This allows students to reason in familar ways in the analogous space,
and to transfer that reasoning to the programming space.
We collected and organized the following 19
analogy-based notional machines:
PL | NM |
array |
row of spaces in a parking lot |
array element |
car |
element index |
space number in lot |
element value |
specific car in a specific value |
PL | NM |
array |
stack of boxes |
array element |
box |
element index |
number on each box |
element value |
post-it in box |
PL | NM |
array |
row of students |
array element |
student (standing in a row) |
element index |
relative position of the student, start with 0 |
element value |
nationality of student |
PL | NM |
call stack |
stack of papers |
stack frame |
sheet of paper |
local variable |
line of text on a sheet |
call |
push a sheet on top of the stack |
return |
pop the top sheet off the stack |
PL | NM |
function |
black box |
parameters |
arrow into the box |
return value |
arrow out of the box |
PL | NM |
function |
tank |
parameters |
hoppers on top of tank |
return value |
output pipe on bottom of tank |
PL | NM |
grammar rule |
a train track with a start and an end |
parsing or generating |
pushing a train engine through the train track |
terminal symbol (in a grammar rule) |
tunnel representing a terminal symbol, generating or recognizing the text with which it is labeled |
non-terminal symbol (in a grammar rule) |
tunnel representing a non-terminal symbol, invoking the rule mentioned on its label |
sequence |
track segment going from one tunnel to the next |
selection |
two switches to split and join the track, requiring the train engine to decide which track to take |
repetition |
two switches allowing the train engine to go back and repeat a part of the grammar multiple times |
PL | NM |
HashSet |
Box of hanging folders |
bucket |
Single file folder |
key |
Piece of paper in a file folder |
value |
N/A (HashSet, not HashMap) |
add(key) method |
Find correct folder, check if the folder already contains the key by comparing the key to all contents of the folder |
PL | NM |
list |
stack of boxes on a pallet |
list element |
box on the stack |
[ |
top of the stack |
] |
pallet |
PL | NM |
Boolean value |
domino piece (standing, or fallen) |
or operation |
two joining lines of dominos |
xor operation |
two lines of dominos like in left image |
and operation |
two lines of dominos like in right image |
function argument |
first domino piece in a line |
function return value |
last domino piece in a line |
PL | NM |
method call |
dance to another location |
return address |
dance back to the previous location |
PL | NM |
class |
natural language description of methods and their behaviors (on sheet of paper) |
object |
student |
method call |
verbal request made to student |
actual argument |
stated as part of verbal request |
return value |
verbal response from student |
PL | NM |
memory cell |
seat |
value |
student or number given to student |
address |
established by counting off |
offset |
number of seats between two targets |
segment |
front, middle, or back of the room |
PL | NM |
procedure |
worker who knows how to do a particular job |
procedure call |
calling the name of the worker, so that he starts doing his particular job |
procedure input |
giving information to the worker (telling them in their right ear) |
procedure implementation |
instructions for the worker on how to do their job |
procedure effect |
how the worker affects the world |
procedure result |
what the worker speaks to the worker on their left |
PL | NM |
processor |
file clerk |
instruction |
action taken by file clerk (e.g., read info off a card) |
PL | NM |
object |
person |
method call |
verbal request to next person in line |
return value |
verbal response from next person in line |
base case |
(action of) last person in line |
recursive case |
(action of) all but last persons in line |
linked list |
line of persons (e.g., waiting in amusement park, or row in classroom) |
PL | NM |
variable |
parking space |
value |
vehicle |
type of variable |
vehicle size/shape/constraint on parking space |
type of value |
type of vehicle |
PL | NM |
Variable |
Box |
access |
opening box, accessing topmost post-it |
rename variable |
new name on box |
assign (list) |
new name also on box |
assign simple value |
second box with same post-it |
PL | NM |
variable |
pigeon hole in shelf |
variable name |
label attached to the pigeon hole |
value |
note inside the pigeon hole |