Perspectives on Teaching Code in Elementary Schools

A Lesson Study Towards a Methodology to Teaching Code in Elementary Schools: Various Perspectives

By: Enzo Ciardelli

Enzo Ciardelli currently works at Guy Brown School in Hamilton. He has taught math for 10 years for grades 4 to 8. While teaching math, he aims to integrate coding and STEM to enrich the learning of students. Enzo also works with his Board to implement robotics into elementary schools.  Follow him on Twitter: @ECiardelli

Educators are discovering for the first time that coding has a place in elementary schools, but how do we make it fit seamlessly? If Hour of Code is the springboard, what happens next? My approach to lesson design embeds coding and Computer Science into math.  This lesson model follows an inquiry and knowledge based format. It centres around students pursuing a goal and giving them time to improve a product through collaboration and feedback. Consider the following observations on coding:

• Building programs is centred around a need or a goal
• Enhancing the programming of a code is a collaborative process
• The thinking processes required by students is intensive
• Coding enriches the curriculum for students
• The application of math is evident and natural
• Scratch is a kid-friendly programming language with many advanced features in coding

In order to highlight these points, we will examine the viewpoints of the teacher, the principal and most importantly, the student. The students for this lesson include Helena and Ailish who are in grade 6 and who have coded for a few months. During the lesson, Ms Kelly Rizzo, the school principal, provided feedback that influenced the direction of the task in a motivational way. If coding is truly important for students, we have to gather the thoughts of various participants.

The Planning Phase

I recently had the experience of assigning students the task of creating a program that will convert between metric units.  I firmly believe coding requires direct links to learning expectations.  I can highlight the following expectations from the Ontario Mathematics Curriculum:

• Solve problems requiring conversion from metres to centimetres and from kilometres to metres
• Select and justify the most appropriate standard unit

As an extension of thinking processes, I referred to the Ontario curriculum’s achievement chart. In particular, students have to look back at their solutions so that they can make changes towards a desired outcome. The achievement chart likely refers to mathematical solutions, but coding meets and enriches these criteria.

In planning my lesson, I also wanted to introduce different functions of the Scratch programming language. In particular, the following Scratch blocks:

When presenting a coding task, there is a subtlety to introducing a few coding blocks. In so doing, students build their coding skills for future tasks and programming languages. At the same time, discovery is important. It is not necessary to apply direct teaching of these blocks, relying instead on student need or differentiated instruction.

Introduction and First Attempt

Students require little setup. As soon as the task of programming a metric conversion tool was introduced, their minds drifted away from my words and towards the task. While they were working, I periodically looked at their work and asked whether they required assistance. The race was on to be the first student to develop what we refer to as a “basic code.” The goal of the first attempt is to develop a tool that is functional minus extra features. To share codes and enhance their programs, the “basic code” is their price of admission. As an entry point, the first attempt only converted centimetres to other metric units. The room was very quiet until the first student announced “I got it!” and the rest of the class released a gasp of despair. The competitive atmosphere is accidental and unavoidable despite my attempts to de-emphasize who reaches “basic code” first. In reaching “basic code,” Ailish explained, “This code was not as good because you can only convert from centimetres.”

The above code reached the desired outcome. This student naturally used a loop function as a remnant of a previous lesson focus. The variables of “mm” and “dm” are also used as second nature at this point of the school year. The desire to introduce the “list block” was integrated with no difficulties. Loops, lists and variables are all words that are used freely in the coding classroom. Helena explained:

“This program was not difficult because I have been using Scratch for some time. Our teacher taught us that you have to multiply and divide to convert. I took what I learned and made the number [variable] divide by 10 or multiply by 10.” – Helena, Student.

It is noteworthy that even students are recognizing how their math learning can be transferred to coding. Upon completion, students decided to share their product with the school principal who praised the students and asked a simple question: “Why does your program only convert centimetres?”

The Second Step: Time to Collaborate and Enhance Codes

“I was curious if they had identified centimetres as a particularly useful unit of measurement for converting both up and down in the metric system. I wanted to hear their explanations for why they chose centimetres to begin with. If they changed the code to allow the user to select the unit, what would they have to change?” – Ms Rizzo, Principal

As was explained to the students, programmers usually make improvements to their program according to feedback from users. The principal’s contribution provided extra motivation to meet the challenge. The group went back to their Scratch programs. Both students decided to create a new Scratch program even though they were provided with the option of altering their existing basic codes. As their teacher, I also knew that their codes would be considerably longer, requiring more thinking, collaboration and math application.

“This code was more challenging”, explained Ailish, “You have to create the program so that it does not convert the wrong unit. My previous code helped because I could copy what I did.” In looking at the above code, it is apparent that the student had to apply more conversions. When Ailish explained her thinking, I realized that the initial step of converting from only centimetres was essential so that students can work towards a more elaborate plan.

Helena added, “If I didn’t code the centimeter app, this one would have been much more confusing.” She is alluding to pedagogy in her young mind knowing that the basic code was a form of scaffolding. Both students incorporated the “if block” and the “list blocks” as was intended. They also relied on previous lessons which introduced variables and repeat loops. Coding is definitely a process that builds from previous knowledge and learning. Upon completion, Helena told me “I felt really good about myself because I thought it would be challenging. I felt that if I could do this one, I could definitely do more coding.”

Evaluation, Reflection and Next Steps

As their teacher, I enjoyed the students’ success. You often tell students that any improvements they make to their codes, regardless of success, is a step in the right direction. While true, a program that reaches my intended goals precisely, brings me much pleasure. Maybe the competitive nature of programming influences me as well! To evaluate their Scratch projects, we always consider the following criteria written in attainable language:

• My program is an enhancement beyond the basic code
• I listen and used most suggestions from others to enhance my code
• I can explain my code using steps and sharing my thoughts
• I incorporate my learning in math into my code
• I can read and understand my classmates’ codes
• I use programming commands that are suggested
• My program is “user friendly”

Student voice is an important aspect of planning next steps. While teachers are perceptive, we learn so much more when we listen. Ailish explained her views on the task and coding which encourages me to continue pushing these students further:

“It’s pretty cool how I learned to use these blocks and variables. It is cool that I get the opportunity to learn this. I completed a complex code that helps with the math curriculum. In high school, I will take Computer Science because I like math. It (coding) is confusing but fun.” – Ailish, Student

When I asked Ms Rizzo about coding integration in math instruction she asserted, “I see it as something that has potential and certainly something that can engage a range of learners.”

As students progress in their math, I find ways to incorporate coding once again. These students will be learning multiplication and division next, which prompts me to think of coding ideas with computer science tie-ins. Maybe I will teach them to code a division calculator which requires floor and ceiling functions. Maybe we can incorporate more blocks so that they construct a program that finds factors. To find factors, they could incorporate another list block feature into their codes. By adding more blocks, they are learning sophisticated coding functions using a kid-friendly programming language. In terms of reflection, a model for a coding lesson structure emerges. This format starts with an attainable entry point and progresses in difficulty. Along the way, the lesson relies on student feedback and collaborative thinking. Motivation and growth mindset are all embedded in this type of instruction.

*** I would like to extend my gratitude to Ailish, Helena and their families for allowing me to include their wonderful ideas into this writing.  Thank you also to Ms Kelly Rizzo, our School Principal.  Their contribution definitely brings much added value to this piece!