Richard Feynman’s Notional Machine

Matthias Hauswirth
Luce Research Lab
Published in
4 min readAug 30, 2019

What does the famous physicist have to do with programming education?

Richard Feynman, teaching. Image: Wikipedia

In programming education we have that idea of a “Notional Machine”, a term introduced by Benedict DuBoulay in 1981. At a recent Dagstuhl seminar on Notional Machines and Programming Language Semantics in Education, Ben Shapiro defined Notional Machine in a way that very much resonates with me:

A notional machine is an explanation of the rules of a programmable system. The rules account for what makes a program a valid one and how a system will execute it.

Searching for Notional Machines

After that seminar, I started looking for uses of notional machines, according to that definition, in the wild. I started by talking to my own colleagues at USI. The first person I talked to was Antonio Carzaniga. Antonio is a bit of a physics buff. He told me about a notional machine he uses in his own courses. I wasn’t surprised Antonio would use some kind of notional machine to support his teaching of programming. What surprised me, though, was what inspired him to use that specific notional machine: a lecture by Richard Feynman.

I doubt Feynman was aware of the term “Notional Machine” when he gave this lecture (probably a couple of years after DuBoulay coined the term). But I think it’s amazing how Feynman put together, at that time, an elaborate notional machine to explain imperative programming languages, or more specifically, how assembly programs execute on a stored-program computer.

The “File Clerk” Notional Machine

Feynman presents the situation of a big company with many salespeople. The company needs to keep all its information organized and up-to-date. For this, the company uses a filing system (memory). That filing system consists of a lot of boxes and folders containing cards (records) with information: A card for each salesperson with their sales total. A card for each sale. A card for each geographic region with the region’s sales total. Lots and lots of cards. With all the information needed to operate that company.

The company occupies a file clerk (processor), a person who keeps an up-to-date record of the current situation of the company, by maintaining the information stored on all the cards.

The file clerk uses a scratch pad (registers) to perform operations. He copies numbers over from cards onto the scratch pad, does the calculation, and then puts the result back onto some card. Feynman talks about different kinds of data (not just numbers), and that even instructions are just data. He talks about a program counter register on the scratch pad, to keep track of the next instruction the clerk will need to perform. And he talks about the idea of calling a subroutine (for example to perform multiplication) and knowing what to do when the clerk is done with that subroutine (calling conventions).

But instead of reading my description of his notional machine, why don’t you just take some time and watch the great Feynman himself in the video above?

Thoughts

Feynman’s notional machine isn’t perfect. For example, at times he is fuzzy with the distinction between an individual memory cell or variable, and a card that contains an entire record with several fields. And sometimes the metaphor wears thin, when his description of the metaphorical machine turn into pretty much direct descriptions of the corresponding machine instructions.

But then, sometimes the metaphor works beautifully. For example, Feynman even brings up parallel processing, challenging the reader to think how to implement computations with multiple file clerks, and how to ensure they don’t step on each other’s feet.

It’s also interesting to hear that Feynman looks at a computer as something that’s more about data, and less about computation! He complains that computers shouldn’t really have been called “computer”. That’s where he then pulls out the term “filing system”, because that’s what he sees as a computer’s primary role: the handling of data.

After finding his video, I also found a posthumously created book: “Feynman Lectures on Computation”. This is essentially a textbook distilled from the lecture notes of a computer science course he co-taught at CalTech. It starts out with a section introducing the “File Clerk Model”. I didn’t know Feynman taught computer science (I guess I should have!), and I certain didn’t know that this great physicist’s computer science course started out by introducing a notional machine!

What Now?

Feynman was a brilliant mind. And a fascinating educator. So, should we use Feynman’s notional machine when teaching programming today? I think the answer is “no”. Times have changed. I suspect few novice programmers are aware of “file clerks”, paper-based “filing systems”, or “cards” that are filed. These metaphors Feynman employed may once have been real world concepts. Concepts Feynman’s students could directly relate to. However, these concepts have been replaced by virtual world concepts.

So, Feynman employed a metaphor to explain how programs work, and the programmers he taught, over the years, then automated his metaphor away.

--

--