The Rules of Program Behavior framework notes that teachers target a model of program behavior instead of the complex semantics of the programming language, and allows describing these models as sets of rules of program behavior. When learners execute code, its behavior is defined by the semantics of the programming language, which might differ from the targeted model of program behavior. In this paper, we present a theoretical framework that builds on the Rules of Program Behavior framework, while giving a more prominent role to the differences between the targeted models and the programming language semantics. We call these differences Program Behavior gaps and distinguish between incompleteness gaps—untaught parts—and conflict gaps—a semantic rule that conflicts with a rule of program behavior—, and between transparent and opaque gaps. Visualizations of the relation between the semantics of the programming language and the targeted model of program behavior are an integral part of our framework as they allow visualizing the gaps that could exist in a code fragment and whether these gaps are activated or not. On top of this, the framework contains clear definitions to distinguish between valid conceptions, misconceptions, missing conceptions, prior conceptions, fluid conceptions and program behavior gaps. The framework can be used to devise programming courses, to investigate the mental model of learners and to make a case for gradually evolving languages that are designed to have fewer program behavior gaps. To illustrate this, we (1) present a real-life progression of models of program behavior and discuss, for this progression, the program behavior gaps in twenty-one code fragments, and (2) present a study grounded in our theoretical framework in which we determine the mental model of each participant.
Hoobergs et al. (Mon,) studied this question.