Coding in the Classroom | PRIMM

A framework for teaching coding
By: Steven Floyd

The Ontario Mathematics Curriculum for grades 1-8 includes two specific expectations related to coding, for each grade:

  • write and execute code to solve problems and create computational representations of mathematical situations;
  • read and alter existing code and describe how changes to the code affect the outcomes.

In this article we’ll discuss the PRIMM framework, which can be leveraged to help students move from reading and altering code in expectation 3.2, to writing their own programming code in expectation 3.1.

An image of the coding curriculum expectations found in the grades 1-8 mathematics curriculum.
From the Ontario Grades 1-8 Mathematics Curriculum Expectations, 2020 – Strand C: Algebra

PRIMM, first described here, stands for Predict, Run, Investigate, Modify and Make. It is a framework for teaching coding that supports students with reading code prior to being asked to code an application without enough prior knowledge. PRIMM focuses on students having discussions about what a program will do, how and why the program works, and then editing and writing their own programs afterwards.

An image of the ScratchJr coding environment with a student's program displayed.
What kind of discussions will students have about this program?
Will they be able to determine the impact of each block of code,
and possibly predict the path that the character will take?
Can they predict where the character will end up?
Coded with ScratchJr.

A key component of the PRIMM framework is that it aligns with Vygotsky’s zones of proximal development, which is the distance between what a learner can do on their own, and what they can do with guidance from an adult or peer. PRIMM aims to move students through the zone of proximal development resulting in a more in-depth understanding of the concepts and/or improved skills.

Predict: Students are provided with code for a program and they predict, together, what the program will do. They do this through conversations and discussions.

Run: After students make predictions about the execution of the program, they run the code and test their prediction.

Investigate: Students take a closer look at the different components of the code, as the teacher suggests activities such as tracing through code and explaining or adding notes to specific parts of the code.

Modify: Students alter the code in order to solve small, related problems or activities provided to them by their teacher.

Make: At this point, students can create their own program that uses many of the components and concepts from the original code that was provided to them, but that serves a new purpose or generates new output or conclusions.

An image of the ScratchJr coding environment with a student's program displayed.
Will students be able to discuss this code, and re-enact the character’s dance themselves?
Coded with ScratchJr.

Important: An important aspect of the PRIMM framework is having students discuss the program components with a teacher or peer. This allows for the social construction of knowledge, and highlights the role of language in learning, and the overlooked role of language in learning coding specifically. It can also be very fun and provide the teacher with great insight into the thought processes of their students.


Sentance, S., Waite, J., & Kallia, M. (2019). Teaching computer programming with PRIMM: A sociocultural perspective. Computer Science Education, 29(2-3), 136-176.

Scroll to Top