SlideShare a Scribd company logo
1 of 36
Download to read offline
The I in PRIMM
Code comprehension and questioning
Dr Sue Sentance
29th February 2020
@suesentance
CAS London Conference 2020
Objectives of this session
- To briefly outline the PRIMM methodology and point to
some resources
- To introduce the Block Model as a way of thinking about
programming at different levels
- How we can use questioning and targeted tasks to
support comprehension of program code
- To share some potential tasks around code
comprehension that you could use on Monday!
What can cause learners to struggle with
programming tasks?
Challenges faced Possible reasons …
Perception of
programming as hard –
challenges resilience and
self-efficacy
Programs usually don’t work until many iterations have
passed
There is a “hard” myth (or is it a myth)
Belief in geek gene
Use of “adult” teaching approaches
A working program does
not equate to
understanding of
programming concepts
Too much copying of code without understanding
High cognitive load involved in programming
Focus on product rather than process
Students have
misconceptions &
incorrect mental model
Many misconceptions are known but this has not
transferred into teacher training
Teachers have fragile knowledge & misconceptions too
Programming pedagogy & PRIMM
Some examples:
• Pair programming (Williams & Kessler,
2002)
• Worked examples (Morrison,
Margulieux & Guzdial, 2015)
• Peer instruction (Porter et al, 2011)
• Live coding/ modelling (Rubin, 2013)
• Tracing/ reading code (Lister, many)
• Use-modify-create (Lee et al, 2011)
• Stepwise explanations (Wirth, 2001)
In this context, PRIMM is one approach
to use for programming pedagogy
Specifically it is designed to:
1) Help teachers structure lessons
2) Reflect on the teaching process
3) Cater for varying needs
The PRIMM approach
• Predict – given a working program, talk about it in
pairs or groups. What do you think it will do?
• Run – run it and test your prediction
• Investigate – get into the nitty gritty. What does
each line of code mean? Lots of activities to try
here: trace, annotate, explain, talk about,
identify parts, etc….
• Modify – edit the program to make it do different
things
• Make – design a new program that uses the same
nitty gritty but that solves a new problem
Look at this Python (turtle) code
Discuss with the person next to you
Draw the output
What discussions did you have?
Did you help each other?
What did you learn?
An activity for you – you will need a piece of paper and a companion
Now imagine you could run the program
This is what would actually be output
Did you get it right?
If not, what is different about your answer?
PRIMM Examples
Predict
Run
Investigate
Modify
Make
Lesson 3
PRIMM Examples
Predict
Run
Investigate
Modify
Make
Keep starter programs
on a shared drive
Students should
download, check what
they do and compare
with prediction
PRIMM Examples
Predict
Run
Investigate
Modify
Make
Ask different types of questions
PRIMM Examples
Predict
Run
Investigate
Modify
Make
PRIMM Examples
Predict
Run
Investigate
Modify
Make
PRIMM Examples
Predict
Run
Investigate
Modify
Make
Improve the pizza program so that it doesn’t print out
“and X” at the end. You will have to add an “if”
statement to do this.
Modify the program to have a conversation with
somebody about sport. An example is given below but
you can add your own questions.
Change your triangle function so that it uses a for loop
Write a function pentagon() to create a pentagon (5
sides) with sides length 200
Write a function hexagon() to create a blue hexagon (6
sides) with sides length 50
PRIMM Examples
Predict
Run
Investigate
Modify
Make
Focusing in on Investigate
What are good questions to ask?
Here are two programs (they do the same thing – just choose
the language you prefer!)
What questions might you ask learners to help you gauge their
understanding?
Activity 1: Asking questions
Two versions of the same program
In pairs or threes, think about some good
“Investigate” questions you could ask pupils
to see if they understood the code – and to
prepare them to write something similar
Feedback
Why focus on code comprehension?
• Being able to read and understand code greatly increases
your ability to write code (proven by research)
• Talking about the program means you need the words to
label the various parts – so improves program terminology –
the teacher can help here
• The goal of program comprehension is to allow the
beginner programmer to construct their own mental model.
But how do we know if we are asking the right questions?
And if the pupils can’t answer what does that tell us?
Enter …. The Block Model
What if we could classify tasks and questions?
What is … ?
How would
you …?
Can you spot
the …?
Show me a
… ?
What does …
do?
Granularity of
piece of program
code
Structure ---> Function of program
(M) Macro structure Understanding the
overall structure of the
program text
Understanding the
algorithm underlying a
program
Understanding the
goal/purpose of the
program in the current
context
(R) Relationships Relationships between
blocks
Sequence of function
calls, object sequence
diagrams
Understanding how sub
goals are related to goals
(B) Blocks Regions of interest that
build a unit (syntactically
or semantically)
Operation of a block or
function.
Understanding of the
function of a block of
code.
(A) Atoms Language elements Operation of a
statement.
Function of a statement.
(T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
(M) Macro structure
(R) Relationships
(B) Blocks
(A) Atoms Identify the keywords in
a piece of code
(T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
When a student really understands
the program code they should be
able to answer questions in every
area of the Block Model
(M) Macro structure What does this program
do?
(R) Relationships
(B) Blocks
(A) Atoms Identify the keywords in
a piece of code
(T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
When a student really understands
the program code they should be
able to answer questions in every
area of the Block Model
Activity 2: Types of questions/tasks
In pairs or threes ….
Look at the list of possible tasks/questions around code
comprehension
Where might they fit on the Block Model?
Example
(M) Macro structure Annotate the whole
program showing where
functions are called and
defined.
What set of inputs
could be used to check
all routes/flows through
the program
Summarise what the
program does
(R) Relationships Identify the scope of a
variable
Identify which branch
of an if statement will
never be executed
Identify two blocks of
code which will produce
the same outputs
(B) Blocks Draw a block around an
if statement
Solve a Parson’s
Problem
Give an appropriate
name to a block of code
or function
(A) Atoms List all the integer
variables
Trace a value through
the program code
Identify the purpose of a
single statement
Answer (T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
(M) Macro structure
✓ ✓ ✓
(R) Relationships
✓ ✓ ✓
(B) Blocks
✓ ✓ ✓
(A) Atoms
✓ ✓ ✓
Answer (T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
Carla
Mia
(M) Macro structure
X ✓ ✓
(R) Relationships
✓ ✓ ✓
(B) Blocks
✓ X X
(A) Atoms
✓ X ✓
Answer (T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
Carla
“Novice programmers’ early
comprehension models can be
characterized by a pattern of “holey
knowledge”(i.e. an incomplete
patchwork of fabric, with empty
cells and missing stuffing)” (Schulte
et al, 2010)
Why is it important to ask different types of questions
about the code?
The Holey
Quilt
(gaps in
knowledge)
“Novice programmers’ early
comprehension models can be
characterized by a pattern of “holey
knowledge”(i.e. an incomplete
patchwork of fabric, with empty
cells and missing stuffing)” (Schulte
et al, 2010)
The programming “mental model”
Includes:
- Elements and structure of the program
- Execution behaviour of the program
- Purpose of the whole program
- Purpose of individual blocks
How is the mental model developed? One view ….
Social plane Cognitive plane
(Vygotsky)
Activity 3: Revisiting activity 1
Now look back at the program we looked at earlier
You thought of some questions
Where are these in the Block Model?
Discuss ….
Which tasks and questions are easier to answer than others?
How to progress through different
questions and tasks?
(M) Macro structure Understanding the
overall structure of the
program text
Understanding the
algorithm underlying a
program
Understanding the
goal/purpose of the
program in the current
context
(R) Relationships Relationships between
blocks
Sequence of function
calls, object sequence
diagrams
Understanding how sub
goals are related to goals
(B) Blocks Regions of interest that
build a unit (syntactically
or semantically)
Operation of a block or
function.
Understanding of the
function of a block of
code.
(A) Atoms Language elements Operation of a
statement.
Function of a statement.
(T) Text Surface (P) Program Execution (F) Function
Architecture/ Structure Relevance /Intention
The Block Model
What about progression
through the types of
tasks? ?
What does the program do?
“One interesting observation is that students often have
difficulties explaining the purpose of the whole program (MF),
and if asked to describe the code goal, they explain the
execution of the program (P) and often step-by-step.” (Izu et
al, 2020).
In PRIMM we start with predicting the purpose of a small block
of code. This serves as a reminder that this is not easy for
students, and so simple, short extracts of code should be used.
The goal of predict is to get students used to thinking about
why programs are there and to focus on function first.
Try it out with your classes
Try to ask different questions about programs in your class
Which types of question are most difficult/ easy?
Where is the progression?
Where can we uncover misconceptions?
Try out in your class. Do share any insights with me.
This work is ongoing research. More details will appear at
http://primming.wordpress.com
PRIMM Resources
http://primming.wordpress.com
Materials here that were
used for the two
research studies – and in
time we hope to upload
teachers’ contributions
from their own PRIMM
resources
If you have PRIMM
resources please share
with me!
Summary
- A brief introduction to PRIMM
- The importance of understanding program code
- The Block Model for code comprehension
- Some tasks and questions to use in class
- Remember the holey quilt!
Further reading (if you like depth)
Izu et al (2019). Fostering Program Comprehension in Novice Programmers-Learning Activities and Learning
Trajectories. In Proceedings of the Working Group Reports on Innovation and Technology in Computer Science
Education (pp. 27-52).
Sentance, S., Waite, J., & Kallia, M. (2019). Teaching computer programming with PRIMM: a sociocultural
perspective. Computer Science Education, 29(2-3), 136-176.
Further browsing
http://primming.wordpress.com
Thanks for participating
Contact me at
sue@raspberrypi.org or
sue.sentance@kcl.ac.uk
@suesentance

More Related Content

What's hot

Free gmat-flashcards
Free gmat-flashcardsFree gmat-flashcards
Free gmat-flashcardsSivaprakash
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern11prasoon
 
Top 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxTop 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxBOSC Tech Labs
 
L14 exception handling
L14 exception handlingL14 exception handling
L14 exception handlingteach4uin
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language Hitesh-Java
 
Javascript Prototype Visualized
Javascript Prototype VisualizedJavascript Prototype Visualized
Javascript Prototype Visualized军 沈
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)paramisoft
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedVisual Engineering
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency InjectionTheo Jungeblut
 
Visual Studio Code Can Do That: Tips & Tricks
Visual Studio Code Can Do That: Tips & TricksVisual Studio Code Can Do That: Tips & Tricks
Visual Studio Code Can Do That: Tips & TricksMicrosoft Tech Community
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkHùng Nguyễn Huy
 
Шаблоны разработки ПО. Шаблоны GRASP
Шаблоны разработки ПО. Шаблоны GRASPШаблоны разработки ПО. Шаблоны GRASP
Шаблоны разработки ПО. Шаблоны GRASPSergey Nemchinsky
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript EngineKris Mok
 

What's hot (20)

Free gmat-flashcards
Free gmat-flashcardsFree gmat-flashcards
Free gmat-flashcards
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
 
Top 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxTop 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptx
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
L14 exception handling
L14 exception handlingL14 exception handling
L14 exception handling
 
Computer science essay..
Computer science essay..Computer science essay..
Computer science essay..
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Javascript Prototype Visualized
Javascript Prototype VisualizedJavascript Prototype Visualized
Javascript Prototype Visualized
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux Advanced
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency Injection
 
Visual Studio Code Can Do That: Tips & Tricks
Visual Studio Code Can Do That: Tips & TricksVisual Studio Code Can Do That: Tips & Tricks
Visual Studio Code Can Do That: Tips & Tricks
 
clean code - uncle bob
clean code - uncle bobclean code - uncle bob
clean code - uncle bob
 
Composite pattern
Composite patternComposite pattern
Composite pattern
 
Builder pattern
Builder patternBuilder pattern
Builder pattern
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Шаблоны разработки ПО. Шаблоны GRASP
Шаблоны разработки ПО. Шаблоны GRASPШаблоны разработки ПО. Шаблоны GRASP
Шаблоны разработки ПО. Шаблоны GRASP
 
Exception handling
Exception handling Exception handling
Exception handling
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
 

Similar to The I in PRIMM - Code Comprehension and Questioning

Teaching of computer programming
Teaching of  computer programmingTeaching of  computer programming
Teaching of computer programmingmarpasha
 
12266422.ppt
12266422.ppt12266422.ppt
12266422.pptCSEC5
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxDrYogeshDeshmukh1
 
Mit109 – software engineering
Mit109 – software engineeringMit109 – software engineering
Mit109 – software engineeringsmumbahelp
 
Mit109 – software engineering
Mit109 – software engineeringMit109 – software engineering
Mit109 – software engineeringsmumbahelp
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsMichael Heron
 
software engineering
software engineeringsoftware engineering
software engineeringTayfun Çelik
 
Mit3033 software architecture
Mit3033  software architectureMit3033  software architecture
Mit3033 software architecturesmumbahelp
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2Ankit Dubey
 
M256 Unit 1 - Software Development with Java
M256 Unit 1 - Software Development with JavaM256 Unit 1 - Software Development with Java
M256 Unit 1 - Software Development with JavaYaseen
 
Google Interview Prep Guide Software Engineer
Google Interview Prep Guide Software EngineerGoogle Interview Prep Guide Software Engineer
Google Interview Prep Guide Software EngineerLewis Lin 🦊
 
CS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdf
CS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdfCS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdf
CS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdfTitoMido1
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patternsAmit Kabra
 
2015_CTI_IS-Internet-Development_Module-Description_Final
2015_CTI_IS-Internet-Development_Module-Description_Final2015_CTI_IS-Internet-Development_Module-Description_Final
2015_CTI_IS-Internet-Development_Module-Description_FinalMoses75
 

Similar to The I in PRIMM - Code Comprehension and Questioning (20)

Teaching of computer programming
Teaching of  computer programmingTeaching of  computer programming
Teaching of computer programming
 
12266422.ppt
12266422.ppt12266422.ppt
12266422.ppt
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptx
 
Mit109 – software engineering
Mit109 – software engineeringMit109 – software engineering
Mit109 – software engineering
 
Mit109 – software engineering
Mit109 – software engineeringMit109 – software engineering
Mit109 – software engineering
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design Patterns
 
software engineering
software engineeringsoftware engineering
software engineering
 
Brochure curriculum (1)
Brochure curriculum (1)Brochure curriculum (1)
Brochure curriculum (1)
 
Mit3033 software architecture
Mit3033  software architectureMit3033  software architecture
Mit3033 software architecture
 
Patterns Overview
Patterns OverviewPatterns Overview
Patterns Overview
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
M256 Unit 1 - Software Development with Java
M256 Unit 1 - Software Development with JavaM256 Unit 1 - Software Development with Java
M256 Unit 1 - Software Development with Java
 
Google Interview Prep Guide Software Engineer
Google Interview Prep Guide Software EngineerGoogle Interview Prep Guide Software Engineer
Google Interview Prep Guide Software Engineer
 
CS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdf
CS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdfCS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdf
CS251 Intro. to SE [Lec. 0 - Course Introduction & Plan] Spring 2022.pdf
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
OOP Java
OOP JavaOOP Java
OOP Java
 
2015_CTI_IS-Internet-Development_Module-Description_Final
2015_CTI_IS-Internet-Development_Module-Description_Final2015_CTI_IS-Internet-Development_Module-Description_Final
2015_CTI_IS-Internet-Development_Module-Description_Final
 
DP PPTS by BK.pptx
DP PPTS by BK.pptxDP PPTS by BK.pptx
DP PPTS by BK.pptx
 
010821+presentation+oti.ppt
010821+presentation+oti.ppt010821+presentation+oti.ppt
010821+presentation+oti.ppt
 
Modest Formalization of Software Design Patterns
Modest Formalization of Software Design PatternsModest Formalization of Software Design Patterns
Modest Formalization of Software Design Patterns
 

More from Sue Sentance

Primm and Classroom Talk Sue Sentance Nov 2020 pdf
Primm and Classroom Talk  Sue Sentance Nov 2020 pdfPrimm and Classroom Talk  Sue Sentance Nov 2020 pdf
Primm and Classroom Talk Sue Sentance Nov 2020 pdfSue Sentance
 
Westiminster EForum 15 December 2020 Sentance
Westiminster EForum 15 December 2020 SentanceWestiminster EForum 15 December 2020 Sentance
Westiminster EForum 15 December 2020 SentanceSue Sentance
 
WiPSCE Keynote 2019 Sue Sentance
WiPSCE Keynote 2019 Sue SentanceWiPSCE Keynote 2019 Sue Sentance
WiPSCE Keynote 2019 Sue SentanceSue Sentance
 
Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018Sue Sentance
 
Recent developments in CS education research Jul 18
Recent developments in CS education research Jul 18Recent developments in CS education research Jul 18
Recent developments in CS education research Jul 18Sue Sentance
 
SS CAS London Royal Society Report Summary
SS CAS London Royal Society Report SummarySS CAS London Royal Society Report Summary
SS CAS London Royal Society Report SummarySue Sentance
 
The computing revolution in England November 2015
The computing revolution in England November 2015The computing revolution in England November 2015
The computing revolution in England November 2015Sue Sentance
 

More from Sue Sentance (7)

Primm and Classroom Talk Sue Sentance Nov 2020 pdf
Primm and Classroom Talk  Sue Sentance Nov 2020 pdfPrimm and Classroom Talk  Sue Sentance Nov 2020 pdf
Primm and Classroom Talk Sue Sentance Nov 2020 pdf
 
Westiminster EForum 15 December 2020 Sentance
Westiminster EForum 15 December 2020 SentanceWestiminster EForum 15 December 2020 Sentance
Westiminster EForum 15 December 2020 Sentance
 
WiPSCE Keynote 2019 Sue Sentance
WiPSCE Keynote 2019 Sue SentanceWiPSCE Keynote 2019 Sue Sentance
WiPSCE Keynote 2019 Sue Sentance
 
Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018Teacher toolkit Pycon UK Sept 2018
Teacher toolkit Pycon UK Sept 2018
 
Recent developments in CS education research Jul 18
Recent developments in CS education research Jul 18Recent developments in CS education research Jul 18
Recent developments in CS education research Jul 18
 
SS CAS London Royal Society Report Summary
SS CAS London Royal Society Report SummarySS CAS London Royal Society Report Summary
SS CAS London Royal Society Report Summary
 
The computing revolution in England November 2015
The computing revolution in England November 2015The computing revolution in England November 2015
The computing revolution in England November 2015
 

Recently uploaded

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

The I in PRIMM - Code Comprehension and Questioning

  • 1. The I in PRIMM Code comprehension and questioning Dr Sue Sentance 29th February 2020 @suesentance CAS London Conference 2020
  • 2. Objectives of this session - To briefly outline the PRIMM methodology and point to some resources - To introduce the Block Model as a way of thinking about programming at different levels - How we can use questioning and targeted tasks to support comprehension of program code - To share some potential tasks around code comprehension that you could use on Monday!
  • 3. What can cause learners to struggle with programming tasks? Challenges faced Possible reasons … Perception of programming as hard – challenges resilience and self-efficacy Programs usually don’t work until many iterations have passed There is a “hard” myth (or is it a myth) Belief in geek gene Use of “adult” teaching approaches A working program does not equate to understanding of programming concepts Too much copying of code without understanding High cognitive load involved in programming Focus on product rather than process Students have misconceptions & incorrect mental model Many misconceptions are known but this has not transferred into teacher training Teachers have fragile knowledge & misconceptions too
  • 4. Programming pedagogy & PRIMM Some examples: • Pair programming (Williams & Kessler, 2002) • Worked examples (Morrison, Margulieux & Guzdial, 2015) • Peer instruction (Porter et al, 2011) • Live coding/ modelling (Rubin, 2013) • Tracing/ reading code (Lister, many) • Use-modify-create (Lee et al, 2011) • Stepwise explanations (Wirth, 2001) In this context, PRIMM is one approach to use for programming pedagogy Specifically it is designed to: 1) Help teachers structure lessons 2) Reflect on the teaching process 3) Cater for varying needs
  • 5. The PRIMM approach • Predict – given a working program, talk about it in pairs or groups. What do you think it will do? • Run – run it and test your prediction • Investigate – get into the nitty gritty. What does each line of code mean? Lots of activities to try here: trace, annotate, explain, talk about, identify parts, etc…. • Modify – edit the program to make it do different things • Make – design a new program that uses the same nitty gritty but that solves a new problem
  • 6. Look at this Python (turtle) code Discuss with the person next to you Draw the output What discussions did you have? Did you help each other? What did you learn? An activity for you – you will need a piece of paper and a companion
  • 7. Now imagine you could run the program This is what would actually be output Did you get it right? If not, what is different about your answer?
  • 9. PRIMM Examples Predict Run Investigate Modify Make Keep starter programs on a shared drive Students should download, check what they do and compare with prediction
  • 13. PRIMM Examples Predict Run Investigate Modify Make Improve the pizza program so that it doesn’t print out “and X” at the end. You will have to add an “if” statement to do this. Modify the program to have a conversation with somebody about sport. An example is given below but you can add your own questions. Change your triangle function so that it uses a for loop Write a function pentagon() to create a pentagon (5 sides) with sides length 200 Write a function hexagon() to create a blue hexagon (6 sides) with sides length 50
  • 15. Focusing in on Investigate What are good questions to ask? Here are two programs (they do the same thing – just choose the language you prefer!) What questions might you ask learners to help you gauge their understanding?
  • 16. Activity 1: Asking questions Two versions of the same program In pairs or threes, think about some good “Investigate” questions you could ask pupils to see if they understood the code – and to prepare them to write something similar
  • 18. Why focus on code comprehension? • Being able to read and understand code greatly increases your ability to write code (proven by research) • Talking about the program means you need the words to label the various parts – so improves program terminology – the teacher can help here • The goal of program comprehension is to allow the beginner programmer to construct their own mental model. But how do we know if we are asking the right questions? And if the pupils can’t answer what does that tell us?
  • 19. Enter …. The Block Model
  • 20. What if we could classify tasks and questions? What is … ? How would you …? Can you spot the …? Show me a … ? What does … do? Granularity of piece of program code Structure ---> Function of program
  • 21. (M) Macro structure Understanding the overall structure of the program text Understanding the algorithm underlying a program Understanding the goal/purpose of the program in the current context (R) Relationships Relationships between blocks Sequence of function calls, object sequence diagrams Understanding how sub goals are related to goals (B) Blocks Regions of interest that build a unit (syntactically or semantically) Operation of a block or function. Understanding of the function of a block of code. (A) Atoms Language elements Operation of a statement. Function of a statement. (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model
  • 22. (M) Macro structure (R) Relationships (B) Blocks (A) Atoms Identify the keywords in a piece of code (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model When a student really understands the program code they should be able to answer questions in every area of the Block Model
  • 23. (M) Macro structure What does this program do? (R) Relationships (B) Blocks (A) Atoms Identify the keywords in a piece of code (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model When a student really understands the program code they should be able to answer questions in every area of the Block Model
  • 24. Activity 2: Types of questions/tasks In pairs or threes …. Look at the list of possible tasks/questions around code comprehension Where might they fit on the Block Model? Example
  • 25. (M) Macro structure Annotate the whole program showing where functions are called and defined. What set of inputs could be used to check all routes/flows through the program Summarise what the program does (R) Relationships Identify the scope of a variable Identify which branch of an if statement will never be executed Identify two blocks of code which will produce the same outputs (B) Blocks Draw a block around an if statement Solve a Parson’s Problem Give an appropriate name to a block of code or function (A) Atoms List all the integer variables Trace a value through the program code Identify the purpose of a single statement Answer (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model
  • 26. (M) Macro structure ✓ ✓ ✓ (R) Relationships ✓ ✓ ✓ (B) Blocks ✓ ✓ ✓ (A) Atoms ✓ ✓ ✓ Answer (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model Carla Mia
  • 27. (M) Macro structure X ✓ ✓ (R) Relationships ✓ ✓ ✓ (B) Blocks ✓ X X (A) Atoms ✓ X ✓ Answer (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model Carla “Novice programmers’ early comprehension models can be characterized by a pattern of “holey knowledge”(i.e. an incomplete patchwork of fabric, with empty cells and missing stuffing)” (Schulte et al, 2010)
  • 28. Why is it important to ask different types of questions about the code? The Holey Quilt (gaps in knowledge) “Novice programmers’ early comprehension models can be characterized by a pattern of “holey knowledge”(i.e. an incomplete patchwork of fabric, with empty cells and missing stuffing)” (Schulte et al, 2010)
  • 29. The programming “mental model” Includes: - Elements and structure of the program - Execution behaviour of the program - Purpose of the whole program - Purpose of individual blocks How is the mental model developed? One view …. Social plane Cognitive plane (Vygotsky)
  • 30. Activity 3: Revisiting activity 1 Now look back at the program we looked at earlier You thought of some questions Where are these in the Block Model? Discuss …. Which tasks and questions are easier to answer than others?
  • 31. How to progress through different questions and tasks?
  • 32. (M) Macro structure Understanding the overall structure of the program text Understanding the algorithm underlying a program Understanding the goal/purpose of the program in the current context (R) Relationships Relationships between blocks Sequence of function calls, object sequence diagrams Understanding how sub goals are related to goals (B) Blocks Regions of interest that build a unit (syntactically or semantically) Operation of a block or function. Understanding of the function of a block of code. (A) Atoms Language elements Operation of a statement. Function of a statement. (T) Text Surface (P) Program Execution (F) Function Architecture/ Structure Relevance /Intention The Block Model What about progression through the types of tasks? ?
  • 33. What does the program do? “One interesting observation is that students often have difficulties explaining the purpose of the whole program (MF), and if asked to describe the code goal, they explain the execution of the program (P) and often step-by-step.” (Izu et al, 2020). In PRIMM we start with predicting the purpose of a small block of code. This serves as a reminder that this is not easy for students, and so simple, short extracts of code should be used. The goal of predict is to get students used to thinking about why programs are there and to focus on function first.
  • 34. Try it out with your classes Try to ask different questions about programs in your class Which types of question are most difficult/ easy? Where is the progression? Where can we uncover misconceptions? Try out in your class. Do share any insights with me. This work is ongoing research. More details will appear at http://primming.wordpress.com
  • 35. PRIMM Resources http://primming.wordpress.com Materials here that were used for the two research studies – and in time we hope to upload teachers’ contributions from their own PRIMM resources If you have PRIMM resources please share with me!
  • 36. Summary - A brief introduction to PRIMM - The importance of understanding program code - The Block Model for code comprehension - Some tasks and questions to use in class - Remember the holey quilt! Further reading (if you like depth) Izu et al (2019). Fostering Program Comprehension in Novice Programmers-Learning Activities and Learning Trajectories. In Proceedings of the Working Group Reports on Innovation and Technology in Computer Science Education (pp. 27-52). Sentance, S., Waite, J., & Kallia, M. (2019). Teaching computer programming with PRIMM: a sociocultural perspective. Computer Science Education, 29(2-3), 136-176. Further browsing http://primming.wordpress.com Thanks for participating Contact me at sue@raspberrypi.org or sue.sentance@kcl.ac.uk @suesentance