There is a general sense that programming is related to math and that people who are successful in math are often successful at programming. For math teachers, a natural question arises: “What is the value of computer programming in my classroom?” The reality is that one doesn’t come before the other. Programming directly supports some of the core tenets of how we learn mathematics.
By expanding our idea of what benefits we are bringing students when they program, we can break down some of the stereotypes that limit enrollment in these kinds of programs—stereotypes that hurt the diversity of students who pursue STEM in general. In particular, we believe that programming can develop problem solving skills, encourage students to be more attentive to their work, and persevere in tackling difficult problems—goals for students in every mathematics classroom!
Programming is Problem Solving
When we bring programming to math class, we add a new layer of problem solving: translating mathematical problems/ideas to execute them in code. This often requires students to deepen their mathematical understanding of the problem as they find a way to represent the problem in a programming language.
Programming forces students to be explicit about their problem solving strategies. Writing code encourages students to break the problem into discrete chunks; which is one of the most powerful problem solving techniques in mathematics. A danger with the pencil and paper calculations we rely on in a traditional math assignment is that a student can combine many elements of their problem solving process into one step. As educators, seeing how students approach a problem is invaluable information in supporting their learning.
Attending to Precision
Since the computer can only do exactly what it is told, students need to show precision with their process of translating their plan into code. This forces students to focus on details that they might normally bypass because of difficulty or lack of interest. The syntax of a language is a required step in demonstrating a solution. There is no writing down an answer without showing your work. The work is your answer when you program.
The most tangible benefit for educators that programming can provide is that it constantly provides feedback about student precision. The output of the program is a great place to start, but when there are syntax errors the compiler actually prints out messages to the students (line 5 is missing a semicolon, etc.) and they immediately see the impact their lack of precision had on solving the problem. The fact that students know immediately if they are correct or incorrect is the best formative assessment an educator could hope to provide.
In a traditional school model, this feedback would have to wait until the teacher provided it. Coding allows all students insight into their own comprehension and can provide them the tools to control their growth. This really helps students see the need for precision, which is something that can seem like an arbitrary thing a teacher is asking for in a math class, but has tremendous significance in both fields.
Taking advantage of this immediate feedback can allow students to naturally grow their problem solving abilities. When failure is part of the path towards success, students build perseverance in solving problems. A program produces valid output or has an error. An error is either syntactical (causing the program to not run at all) or logical (resulting in undesired or unexpected output). Debugging, the process of identifying and correcting errors in code, is what students spent most of their time doing when they program. They quickly find that bugs are very common and no one writes error-free code on their first attempt. Because of this, the fear of failure is much lower than in traditional math activities.
Learning how to test if their program is working correctly requires a lot of reflection about how their program works. The need to develop test cases directly encourages students to explore different paths to solve the problem. This cycle of plan, implement, test and repeat is very powerful for keeping students engaged along with the built-in opportunities for “small successes” in every program. This strengthens student perseverance as it becomes clear to them that their effort is rewarded with visible success.
Social Coding
Programming is fundamentally a social process. The image of the lone coder working in their basement is a popular but incorrect stereotype. There is a rich culture of collaboration across the Internet as people who have never met work on improving the same software. This concept, known as open source software, puts the programmer’s work on display (for praise, critique and modification), and the work’s success is measured by whether it is accepted into the cooperative project. In the classroom, this social process is even more evident, as students excitedly talk about strategies to translate ideas into programs.
Beyond the most introductory tasks, almost every programming challenge is a group worthy task with a wide range of possible solutions. This creates great opportunities for students to discuss, challenge, and defend their approaches as they collaborate. When a bug arises, students need to determine exactly why their code is not working. This creates a deeply reflective process within their team’s work.
A Final Note
As educators, we want to create an environment where students are excited to engage with mathematics. We strive to set up classrooms where understanding, rather than memorization, is the path to success. We want our students to be able to collaborate on problems that necessitate collaboration. We want our students to be reflective and adaptive problem solvers. We want our students to find their own path towards a solution because the value of the exercise is in the journey towards the answer. In short, we want all the benefits that coding can bring to our curriculum.