The Block Model
The Block Model is an educational model for describing how students come to understand a program as they read it 1. It is expressed as a table that covers three dimensions in four levels. Each cell represents one aspect of understanding.
The three dimensions are the text surface (the actual text of the program), the program execution (the order in which the program commands happen, and how data is manipulated), and goals (what the program is meant to do). Text surface and program execution are further grouped into structure (the actual expression of code) and function (its intended purpose).
The levels are atoms (individual elements of the language, i.e. keywords and statements), blocks (groupings of code lines that work together, i.e. a loop that sums all the values in a collection), relations (the connections between the bocks), and macro (the overall program).
Macro Structure | Understanding the overall structure of the program | Understanding the 'algorithm' of the program | Understanding the goal/purpose of the program |
---|---|---|---|
Relations | References between blocks, eg. method calls, object creation, accessing data... | sequence of method calls - 'object sequence diagrams' | Understanding how subgoals relate to goals, how function is achieved by subfunctions |
Blocks | 'Regions of Interests' (ROI) that syntactically or semantically build a unit | Operation of a block of code, a method, or a ROI (as a sequence of statements) | Purpose of a block of code, possibly seen as a subgoal |
Atoms | Language elements | Operation of a statement | Purpose of a statement |
Text Surface | Program Execution (data flow and control flow) | Goals of the Program | |
Duality | Structure | Function |
The block model has a direct relationship with the epistemology of programming and the development of schema. Beginning programmers are still learning the atoms of a language (mastering these reflects achieving the preoperational stage). The first schema programmers develop are to reason about the patterns found in the blocks, and further schema help to reason about the relationships between these blocks (Concrete operational stage). Finally, students learn to see how all the pieces of a program come together at the macro level (Formal operational stage).
The block model can therefore help us reason about how our students are able to engage with a program (novices read programs bottom-up, reflecting the order of the table), while more experienced programmers often read top-down, sussing out the purpose of code by the names of functions, classes, etc. and by recognizing the purpose of blocks of code without needing to use code tracing.
-
Carsten Schulte. 2008. Block Model: an educational model of program comprehension as a tool for a scholarly approach to teaching. In Proceedings of the Fourth international Workshop on Computing Education Research (ICER ‘08). Association for Computing Machinery, New York, NY, USA, 149–160. DOI:https://doi-org.er.lib.k-state.edu/10.1145/1404520.1404535 ↩︎