Approach – Code Reading and the Block Model
Summary of Approach
Understanding Code Comprehension with the Block Model—PLAN C Project
Several code reading skills seem to help novices ability to write code on their own. These skills include:
- being able to identify where particular CS concepts are being used in a piece of code
- tracing sequences of code and code with conditionals and loops in it
- explaining the operation of pieces, individual lines, groups of lines or whole pieces of a program
- relating parts of the code to aspects of the problem it’s designed to solve
- We are not advocating a teaching approach that just uses active code reading exercises. Exercises and challenges where novices have to design and implement a new program of their own are really important if we eventually want them to become independent problem solvers.
- We are not saying that a heavily writing orientated approach doesn’t work however it’s likely to be less effective for learners new to these ideas.
- Any exercises that take this approach won’t be as helpful for novices who have fully understood particular CS concepts and how they work. However they do need to be able to clearly explain their thinking and this can be easily assessed by looking at the quality of their answers to these types of exercise.
- In the beginning these exercises should probably use code in the specific programming language you are teaching them with. Several teachers have highlighted learners with less experience becoming confused when the code is in the SQA reference language and the language they are learning.
PLAN C Techniques
There are several techniques we’ve developed to improve novices ability to identify, describe and explain code.
For developing understanding of code that uses sequences, conditionals and loops you could use our technique for Identifying, Describing and Explaining Imperative Code. Moving on to understanding modular programs using subprograms and variables with scope you could try our Identifying, Describing and Explaining Procedural Code technique.
This approach can also be applied to code that isn’t a full programming language such as HTML or CSS. We’ve identified possible relevant concepts in our HTML Identifying, Describing and Explaining Code and CSS Identifying, Describing and Explaining Code techniques.
Reasons for Recommendation
Several studies have explored the relationship between particular code reading skills and learners ability to write code. The current evidence suggests that improving particular code reading skills should help to support learners code writing skills. Additional supporting evidence includes:
- experienced developers eye gaze patterns following the execution order of a set of instructions instead of the usual left to right reading order
- algorithm and code visualisation makes little impact on improving depth of learning without including questions or other activities
- being able to write code in a declarative or block based language appears to improve when learners are given a suitable model of how the instructions are carried out by the computer
Teacher Experiences of Benefits
Pupils in my classes don’t tend to get stuck very often when completing these type of code comprehension exercises. They get to see a greater range of programs which helps them when they have to write code to solve a particular problem or extend an existing solution. They complete these type of challenges much quicker than before and use more CS specific language when describing their problems. I now have a lot more class time for pupils who are missing some of these skills or need longer to develop them.
P W Donaldson- PT Computing, Business Education and Enterprise Crieff High School
The approach allows my classes to focus on comprehension rather than getting bogged down with implementation details. Time that would otherwise be used to enter code can be used for a productive purpose. This allows for a far wider range of examples to be studied and provides pupils with a range of code examples that they can utilise when producing their own code.
W Sargent PT Business and Computing Hyndland Secondary School
Busjahn, T., & Schulte, C. (2013, November). The use of code reading in teaching programming. In Proceedings of the 13th Koli Calling International Conference on Computing Education Research (pp. 3-11). ACM.
Schulte, C. (2008, September). 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 (pp. 149-160). ACM.
Mike Lopez, Jacqueline Whalley, Phil Robbins and Raymond Lister (2008), Relationships Between Reading, Tracing and Writing Skills in Introductory Programming, ICER’08, September 6–7, 2008, Sydney, Australia.
Anne Venables , Grace Tan , Raymond Lister (2009), A closer look at tracing, explaining and code writing skills in the novice programmer, Proceedings of the fifth international workshop on Computing education research workshop, August 10-11, 2009, Berkeley, CA, USA