Learning programming has several challenges:
- It is concept-rich, leading to cognitive overload
- It balances comprehension with coding experience
- It demands persistence and resilience
- Learners need a secure mental model of computation
PRIMM
If you haven’t done so already, you should study the “PRIMM” model of programming instruction, which suggests five stages of interacting with new code: Predict, Run, Investigate, Modify, Make. You can read more about PRIMM in the Teach Computing quick read at helloworld.cc/primmquick and on the blog primming.wordpress.com.
The block model
During the “I” phase of PRIMM, while investigating the code, students should be encouraged to ask questions about it to deepen their understanding. You can prompt them with questions such as:
- What would happen if you swap lines 2 and 3?
- What would happen if you give it input of ___?
- What if you change the symbol on line 5 from > to < ?
- Line 5 shows a condition-controlled loop, why do we call it this?
- What will make the loop end?
We can check we are encouraging valuable thought across the whole range of programming skills using an approach called the “block model”. Devised by Carsten Schulte in 2008, the block model has a grid with two axes, one showing the size of the programming element under consideration, and the other the distinction between the structure, execution and function of the program:

If we map our questions and activities onto the block model, we can then identify any gaps. Adding more tasks in those gaps will ensure that we cover the whole grid. In this way we ensure students are thinking hard about the full range of skills required to thoroughly understand a program.
Find out more
Visit https://blog.teachcomputing.org/quick-read-understanding-program-comprehension-using-the-block-model to find out more about fostering program comprehension, or read the other principles at teachcomputing.org/pedagogy. And subscribe to Hello World to read much more about computing pedagogy every two months: helloworld.raspberrypi.org.
The block model is also explained in “Computer Science Education” edited by Sue Sentance and the new version is available now for around £25 here amazon.co.uk/dp/135005710X. I summarise this principle and many other programming pedagogies in my book “How to Teach Computer Science” available for under £15 here: httcs.online.