Teaching Students Attention to Detail Through Code

by Enzo Ciardelli

Enzo Ciardelli currently works at R.L. Hyslop School in Stoney Creek. 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

Having taught mathematics for more than ten years at various grade levels, I gravitate to tools and practices that promote high interest and learning in the classroom. Since integrating coding, these desired results were immediate. From the start, I noticed that coding forces students to plan how they understand math. Above all else, students are actively engaged and dare I say – fixated – to reach a goal. As they code, students tend to incorporate details that are often overlooked or require repetition from the teacher. How many times have we assessed student work with missing units of measure? I accept the argument that the examples given in this discussion are not really details, but overlooked necessities. Teachers may backtrack from our high expectations thinking students “got the idea” even though they use the word “answer” instead of “product.” An accumulation of forgotten steps does affect understanding of math. Attention to detail is embedded in learning code.

Length > Width

In a grade six class, students had the task of creating a program with Scratch that calculates the area of a shape. Some students were pleased if their Scratch application calculated the area of one shape. Others decided that they could program various sprites so that the user could choose their shape. The task is never complete. Even after achieving the goal, a student questioned how they can incorporate more code so that the program recognizes the length of a rectangle must be greater than its width. His question provoked a discourse which involved students using what we term as CodeSpeak: “We could probably make the program correct this if we use a conditional and an inequality!”IMG_0613We always look for such moments knowing that problems and issues that come from students create teachable moments that students remember. As I continued to teach area, the class referred to this moment and did not repeat the error in their written work. They even recalled that following the formula requires correct substitution in their equation. Coding also helped emphasize very important area rules such as using the height of a parallelogram to calculate the area.

Exterior Angles of Shapes

Very often, we focus on certain skills and knowledge. To teach shapes, I used to re-iterate that the interior angles of a shape will have a relation of 180 degrees. For example, the interior angles of a pentagon will equal 180 x 3. To extend this idea, students would investigate by dissecting a pentagon to create three triangles.

Screen Shot 2016-09-24 at 8.49.10 PMIn teaching about shapes, exterior angles often get less emphasis. When coding a shape using Scratch, students discover that the exterior angles are more important. To create a square, the code might appear as:

Screen Shot 2016-09-24 at 8.49.21 PMWhen drawing other shapes, it becomes apparent that “turn __ degrees” is referring to the exterior angle since using interior angle measure produces an incorrect result.

Screen Shot 2016-09-24 at 8.49.31 PMWe know that students learn math through investigation and authentic practice. The code for any shape allows robots to move in the same pattern. Once again, the exterior angle is more important. Having a robot move correctly provides that authentic practice and students celebrate when they reach the desired result.

Robot Walk

An Emphasis on Language

As my class developed as young programmers, we created a list of criteria so that student work can be compared and assessed. We compared it to rating a video game. The class generated the following criteria:

  • Use of coding functions (i.e. loops, conditionals)
  • User friendly (i.e. anybody can use the program without help)
  • Curriculum (i.e. a science game would include facts and info)

When we considered the Scratch program as user friendly, students started to refer to math language without teacher prompting. When we started coding, we developed programs that calculated the result from addition, multiplication, subtraction and division. In this way, using the word “answer” was deemed unacceptable. For a division program, the sprite had to share the quotient and the remainder with the user. Unintentionally, creating programs became quite the formal activity. For example, students were motivated to use specific terminology for science games and demonstration applications. As students examined each other’s codes, they were quick to point out improvements in language and terminology.


The examples provided are not necessarily “details” when we consider math instruction. They are, however, forgotten by learners. They are smaller points that teachers hope students remember. Learners often forget that the length is greater than the width since they still get the correct measure of perimeter and area. When does differentiating between length and width become more important? Exterior angles are often considered “good to know.” The use of math words and terminology aids in comprehension and expression of math ideas. By incorporating code with math instruction, students discover many rules in math. I can include the following necessities (not details) that have surfaced while students are creating their programs:

  • Multi-step equations stressing order of operations
  • Variables represent ideas, groups of ideas and numbers
  • Relationship between factors and remainders
  • The use of conditionals with probability

As a teacher, I always found myself repeating and demonstrating important math rules. Coding definitely stresses an organisation of thoughts. Using code in math class helps students to retain lessons since they are the architects of their learning.