Coding: Not an “Add on” to Math Instruction

By:  Enzo Ciardelli

Enzo is a Math and French teacher in the Hamilton Wentworth District School Board. He strives to integrate technology into his teaching and learning to prepare kids for the 21st Century workplace.

Is the teaching of coding an “add-on” or a discipline that can be integrated into other subject areas?  While coding can be developed further as its own curriculum area, teachers are finding success teaching young students the basics of computer programming.  The results are staggering!  I have integrated coding in math initially to start a coding club.  I soon realized that coding is best provided as an option in the classroom. In this article, I will outline how computer programming is an integration rather than an “add-on” to our approach in learning.  I would like to highlight that coding is an excellent application of math skills.  All math can be applied to daily life.  As teachers, we have to apply learning so that our students see relevance.  Coding applies so beautifully to math.

Geometry and Spatial Sense

Recently, I was teaching co-ordinate geometry to my grade sixes.  In past years, it was difficult to explain how coordinates on a grid relate to the daily lives of students.  Many students will go into careers that do not involve grids and coordinates.  It was easy to explain and to demonstrate that the coding canvas is really a coordinate grid.  Students understood that computer programmers rely on a coordinate grid to create movement in programs.   What a great application of something that would merely seem like a puzzle without an application!

The above image shows how a character can be moved on a grid by changing x and changing y using Hopscotch.  On the Hopscotch canvas, you can even move the character around and witness the x and y coordinates changing.

The above screenshot from Khan Academy integrates many aspects of geometry to design shapes on the plate. To program a shape, the user must input ellipse(x, y, width, height).  In so doing, the shape is placed on a coordinate plane.  Khan Academy moves away from “block coding” for an ideal experience for more experienced young programmers.

Finally, the use of robots emphasized the construction of shapes in such a motivational way.  Even students with less coding success understood certain aspects and loved the resulting movement of Sphero.  The code below programmed the robot to form a square.

This video shows the Sphero robot in action:

Investigating Formulas

I can recall being taught formulas as a student.  The formula was written on the board and we had to memorize it for success.  We knew better than to ask why a certain formula works or who came up with it. There was little emphasis on investigation.  Today, we try to emphasize the discovery of the formula, but students do not understand it unless they investigate it themselves.  Coding provides the opportunity for students to dig deeply into formulas and understand how they work.

Looking at the above code-in-process, Scratch allows students to construct the formula using operators.  In this process, they understand the order of operations.  If students construct the formula incorrectly, the code will not work, creating the wrong answer.  Without coding, you may think that the wrong answer is a bad thing.  However, students are very committed to ensuring their code and formula work.  They even became obsessive when trying to add lines of code so that their app incorporated units of measure.  When students are persistent on including units of measure to their math, we know that coding serves a purpose in understanding math.

Patterning and Algebra

Patterning and Algebra has to be the most difficult math for students to understand.  Some students love how abstract it is, while others can not understand what a variable is.  Coding provides such a wonderful experience in the application of variables.

Students always have to create a variable to build any code for any strand.  In a very natural way, they understand that variables represent a value that can change.  The use of variables is needed to construct any code regardless of the strand you are teaching.  Accidentally, they are learning about 2-step equations as well.

I can recall doing a problem solving question that involved birds flying in a v-pattern.  While building codes, they created variables as changing values.  We emphasized that the value of the variable depends on what the user enters into the program.  Coding created a challenge for the class when one student incorporated a list (I admit to guiding them in this direction).  Eventually, all the students wanted to incorporate lists into their code.  When have students become so motivated to create a t-chart?  And again, it was actually better when their codes were not working because students were fixated on making it work.  Their mistakes led to better understanding.

Creating Apps for Math

Using Scratch, we were able to create apps to strengthen their understanding of math.  Apps were made for two purposes:

1. Students created apps for math ideas investigated in class.  For example, apps were created for division with remainders, area and volume.  The app below was created to determine the quotient and remainder for a division algorithm.  We developed the code provided while reinforcing different functions.  Concepts of computer science were introduced with the math ideas.  The result was a keen interest in computer science and a
2. Students created apps to assist with problem solving questions.  Once students solved  an assigned
problem, they would create an app that aligns with the facts to create a quicker answer.  Once again, the students gained a precise understanding of the problem.  Students even started to create visually pleasing apps.  We started to evaluate the success of the app according to media principles such as ease of use the language.  The app below was created to align with the following problem:

Katie buys 2 bags of apples for \$5.95.  In each bag, there are 12 apples.
To make money, Katie decides to sell the apples for \$1.00 each.
Unfortunately, she does not sell  3 apples.  Will she make a profit?
Could you suggest ideas so that Katie can sell all the apples and make a profit?

Conclusion

We definitely have to be judicious in choosing tools to introduce in class.  There is a tendency for teachers to become too focused on the tool rather than the curriculum area.  Coding, however, highlights and strengthens students understanding of math.  In terms of learning skills, I have witnessed the persistence students have in developing the perfect code.  When their code works, they exhibit such happiness.  They want to share their code and end up explaining their mathematical processes.  If we do not provide coding as an option, we are denying many learners the opportunity to express themselves using a differentiated method that suits them.