Towards a Notional Machine for Runtime Stacks and Scope: When Stacks Don’t Stack Up

John Clements, Shriram Krishnamurthi

SIGCSE International Computing Education Research Conference, 2022


Background and Context. Modern programming is replete with features like closures, callbacks, generators, asynchronous functions, and so on. These features can be subtle in their behavior and interaction with the rest of the language, so students need notional machines that are both accurate and manageable. We specifically focus on stacks and their associated environments, which are key to understanding these features.

Objectives. What conceptions do students have of stacks and environments on entry to a tertiary, upper-level programming languages course? What impact does coursework around an interpreter-based approach to programming languages education have on their understanding? What is the value of the tooling we create for students to express notional machine states?

Method. Our studies were conducted at two different institutions in a tertiary, upper-level course on programming languages. The intermediate interventions were different, but both used a pre-/post-test format conducted at the beginning and near the end of the semester. We also created a Snap!-based tool to assist in notional machine description.

Findings. We found that students have a relatively weak understanding of stacks and environments at entry, and exhibited various misconceptions. At one institution, which primarily relied on interpreters, we found numerous problems persisted at the end of the semester. At the other, which in addition to interpreters also used direct instruction and the Snap!-based tool, students did much better---but still not on aspects that we would have liked to have transferred from interpreters.

Implications. Our findings suggest that it is important for other educators to also assess their students’ understanding of stacks and environments, especially in light of modern programming concepts. Assuming similar misconceptions are widespread, we believe the community needs to invest much more effort into notional machines, so that students can better understand the features and programs they are working with. In particular, the ‘‘standard’’ stack presentation is insufficient and in some cases even ‘‘harmful’’ (since it reinforces some misconceptions), and hence must be revised. Finally, our study forces a reconsideration of the learning objectives met by interpreters in programming languages education.



These papers may differ in formatting from the versions that appear in print. They are made available only to support the rapid dissemination of results; the printed versions, not these, should be considered definitive. The copyrights belong to their respective owners.