PRIMM: A structured approach to teaching programming

PRIMM is one approach that we hope can help teachers structure lessons in programming. It is based on research into the learning of programming but combines different areas. Our overall interpretation of the research is that teaching programming requires a blended approach using a range of strategies.

PRIMM stands for the following:

Predict

Run

Investigate

Modify

Make

You may not be able to go through all stages in one lesson and may even focus on one stage more than another but remembering PRIMM gives you a way of labelling what you are doing when you are teaching programming.

Being PRIMM-like in your lessons

The following table gives some examples of activities that can be used within a PRIMM-like approach. We would recommend that all these activities are done in pairs.

Stage

Activities

Why

Predict

In pairs look at a piece of code printed out or on the whiteboard and ask students what they think it will do. They can write down their prediction or discuss in a group class discussion. Live coding is quite useful here or the code can be already prepared.

This activity encourages students to look for clues in the program that suggest what its function is.

Run

Download a piece of code from a shared area and check against your prediction (don’t copy in the code).

Having code that is provided has many benefits – it moves the weight of ownership of any errors from the student to the teacher, increasing confidence, and it also means that time is not spent copying in code, which can be a challenging exercise to students who struggle with literacy at any level.

Investigate

There are lots of different activities you can do at this stage: trace through the code, comment the code, answer questions about it, label particular concepts, highlight it, draw the flow of control, etc. Again pair work helps to encourage discussion about the nitty gritty of the program.

It takes many activities of this type, repeated in different forms in different lessons, for students to start to understand the underlying concepts in a secure way. We may tend to think that writing one selection statement correctly means that students have a good understanding of selection but really “getting” this takes some time.

Modify

Given a working piece of code, students are challenged to add a variety of modifications, starting very simply and having a series of exercises increasing in difficulty with larger modifications.

The transfer of ownership moves from the code being “not mine” to “partly mine” as students gain confidence by extending the function of the code. This activity obviously provides the scaffolding that students need to add small snippets of code and see their effect within a bigger program.

Make

Once students are confident in modifying the program that you have created, they can create their own program from scratch, which has similarities with the previous program but that they can design themselves.

Design of a new program is an important skill, and should start with planning and trying to construct a suitable algorithm. This is difficult, but does give students an opportunity to be creative and have the satisfaction of making their own program.

Scaffolding learning

The reason we designed the PRIMM approach is because we recognised, from our own teaching and others’ research, that learners need much more support to understand programming concepts. This means that strategies are needed that scaffold the learning and also promote discussion about what is going on in the programs. Working in pairs can also provide students with mutual support which is a form of scaffolding, as well as promoting discussion and an articulation of the problems, around the code.

Spectrum of techniques

Importantly, copying code in from a worksheet does not give us any indication that a student understands what they are typing in, and the processes involved in copying are high on cognitive load. At the other extreme, tinkering or exploring without guidance can be fun, but without an understanding of the concepts can lead to frustration. Other strategies in between these extremes include running and testing code, predicting outcomes of code, tracing code, annnotation of code, modifying code, etc. and PRIMM is one approach that combines these.

PRIMM Pilot Project Phase 1

In June/July 2017, 6 secondary teachers tried out PRIMM in the classroom using specially designed materials which they were free to adapt for their own classrooms. Pre- and post-tests showed overall that there was an improvement in comprehension in code but these results are not publishable due to weaknesses in the design of these tests. As we are aware that we need to focus the pre- and post- tests we are now planning a Phase 2 of our pilot. The interview data and journals that we gathered from the teachers indicated that our small set of teachers found the PRIMM approach very effective in helping them to structure their teaching of programming, and that the approach supported those who found programming difficult as well as providing opportunities for those to go further who had “got it”. In our small sample teachers were particularly pleased that this approach helped students to understand how functions worked.

PRIMM Pilot Project Phase 2

We would like to recruit about 20 teachers for a second attempt at this pilot project starting in October and running until February/March. If you are interested please sign up here. We are using the same methodology as for the first pilot but we are designing more flexible materials to accompany the PRIMM lessons and will provide tests before and after the intervention. Ideally we would like to trial PRIMM with groups of learners that you have taught some programming to before, but who you feel have struggled with a secure understanding of the concepts.

Sue Sentance

I research computing education in schools, particularly in the UK. My particular interests are programming pedagogy, teacher professional learning in computing, curriculum change, and physical computing. Any views expressed on this site are my own and not endorsed by my employer. I work for the Raspberry Pi Foundation and I'm a Visiting Fellow at King's College London.