Analogy-Based Notional Machines

What is an analogy-based notional machine?

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:

imperative / any Language:

Conceptual Advantage

Builds from the notion of a 'Variable as a Parking Space' and leverages the notion that spaces in larger parking lots are often numbered.

Draws Attention To

The use of indices in arrays as ell as the array's construction from contiguous adjacent variables in memory.
PLNM
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
Collected by Jan Pearce
imperative / any Language:

Conceptual Advantage

Makes arrays tangible, embodied activity.

Draws Attention To

Lists as compound data type
PLNM
array stack of boxes
array element box
element index number on each box
element value post-it in box
Collected by Felienne Hermans
imperative / any Language:

Conceptual Advantage

Creates memorable live demonstration of indexed list elements in order to distinguish between index and value. Also useful to demonstrate out-of-bound errors.

Draws Attention To

Array/list indices and the values at those locations.
PLNM
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
Collected by Craig S. Miller
imperative / any Language:

Conceptual Advantage

Makes concrete the workings of a call 'stack' (push/pop stack frames), and the notion of a 'stack frame'.

Draws Attention To

The call stack.
PLNM
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
Collected by Matthias Hauswirth
imperative or functional / any Language:

Conceptual Advantage

Makes explicit that functions have inputs (parameters) and outputs (return value).

Draws Attention To

Parameter passing and return value.
PLNM
function black box
parameters arrow into the box
return value arrow out of the box
Collected by Jan Pearce
imperative or functional / any Language:

Conceptual Advantage

Makes explicit that functions have inputs (parameters) and outputs (return value).

Draws Attention To

Parameter passing and return value.
PLNM
function tank
parameters hoppers on top of tank
return value output pipe on bottom of tank
Collected by Matthias Hauswirth
declarative / BNF / EBNF Language:

Conceptual Advantage

Pushing a train engine through the track makes visible the process of interpretation (generation or parsing) of the grammar (that is the track).

Draws Attention To

The process of parsing or generating driven by a grammar.
PLNM
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
Collected by Matthias Hauswirth
imperative / Java Language:

Conceptual Advantage

Explains need for hashCode() and equals() methods when using HashSet

Draws Attention To

Need for .hashCode() and .equals(Object o) methods
PLNM
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
Collected by Colleen Lewis
imperative / any Language:

Conceptual Advantage

Emphasises that only the head of list (top box) or the whole list (the stack on the pallet) is directly accessible, and that new items can be added on top of a list but not into the middle of it.

Draws Attention To

First-in, first-out property of a stack.
PLNM
list stack of boxes on a pallet
list element box on the stack
[ top of the stack
] pallet
Collected by Benedict du Boulay
any / any Language:

Conceptual Advantage

See inside logic gates/operations. Construct/invent them from atomic components, and observe/analyze their full workings.

Draws Attention To

The inner workings of a Boolean logic operation (and, or, xor).
PLNM
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
Collected by Matthias Hauswirth
imperative / Java / C# / any Language:

Conceptual Advantage

To illustrate method calls, the teacher dances to another location, performs some actions there (changing the memory), and then returns to the previous location through the return address, where he continues with performing actions

Draws Attention To

It illustrates that you `go elsewhere in the memory' when you call a method, and that you need to remember where you came from (return address) when you go elsewhere. A dancing teacher helps students to remember the concept.
PLNM
method call dance to another location
return address dance back to the previous location
Collected by Johan Jeuring
object-oriented / any Language:

Conceptual Advantage

Makes explicit that an object is an identifiable thing that answers to calls.

Draws Attention To

Objects, method calls, and returns.
PLNM
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
Collected by Matthias Hauswirth
imperative / assembly Language:

Conceptual Advantage

Provides tangible focus for discussing addresses, offsets, and even byte ordering and segments.

Draws Attention To

Relationships between items in memory, whether they are elements of an array, bytes in a single value, or different methods for allocating space.
PLNM
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
Collected by Andrew Petersen
imperative / any Language:

Conceptual Advantage

Provides a way to visualise input and action, and later the difference between action and output. The same visualisation extended to cover user defined procedures, parameters and later to explain sub-procedure calls including recursion.

Draws Attention To

PLNM
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
Collected by Benedict du Boulay
imperative / any Language:

Conceptual Advantage

Makes explicit the difference between data and instructions, shows how little a single instruction really can achieve. Can be stretched to explain all kinds of concepts (although eventually becomes a bit of a stretch).

Draws Attention To

Data an instruction operates on, 'mechanistic' workings of instructions.
PLNM
processor file clerk
instruction action taken by file clerk (e.g., read info off a card)
Collected by Matthias Hauswirth
imperative / any Language:

Conceptual Advantage

Makes explicit recursive calls as a form to 'delegate' parts of work, base case as a situation where delegation stops. Allows unpacking many aspects of recursive computation (pairing of call/return, passing info down through params, up through return values, tail recursion).

Draws Attention To

Recursive calls and returns, base case & recursive case, tail recursion
PLNM
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)
Collected by Matthias Hauswirth
imperative / staticaly-typed Language:

Conceptual Advantage

Helps understanding of why types matter both in parking spaces and in statically-typed languages

Draws Attention To

The idea of a statement, a condition, and how they are used to build sequence, selection, and repetition constructs of structured programming
PLNM
variable parking space
value vehicle
type of variable vehicle size/shape/constraint on parking space
type of value type of vehicle
Collected by Jan Pearce
Variable as Box
Analogy
imperative / any Language:

Conceptual Advantage

Makes variable tangible, embodied activity

Draws Attention To

Variables, access, initialization
PLNM
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
Collected by Felienne Hermans
imperative / BASIC Language:

Conceptual Advantage

Makes variable tangible, gives impression of memory as a bunch of variables

Draws Attention To

Variables contain values
PLNM
variable pigeon hole in shelf
variable name label attached to the pigeon hole
value note inside the pigeon hole
Collected by Matthias Hauswirth