Problem Solving & Coding

by Steven Floyd

Steven Floyd ( is a HS CompSci/CompEng. Teacher in the London Catholic District School Board. Follow on Twitter @stevenpfloyd. See his latest math + coding project.

Educators may have noticed an increased amount of attention being paid to coding and computer programming in our schools. Supporters of these initiatives (full disclosure: I’m one of them) will list a number of reasons for the inclusion of coding and computer programming, or the broader term: computational thinking, in a student’s education. I’d like to focus on just one.

Computer Programming and The Development of Problem Solving Skills

Problem solving is recognized as an important skill for our students to develop. Many repetitive jobs and processes will soon be completed by robots or algorithms leaving workers to be trouble shooters and problem solvers. The Ontario Curriculum Grades 1-8 lists Problem Solving as the first of the Mathematical Processes to be developed in our students.

Screen Shot 2016-09-22 at 7.20.34 PMUnfortunately, problem solving can be a difficult thing to teach. Word problems and case studies often lack the detail required to truly connect with students while simulations lack authenticity. In addition, students often assume the teacher has already solved the problem and therefore look to simply obtain the “correct solution” that the teacher has written down.

To effectively teach problem solving strategies teachers need genuine problems that can be solved in a variety of ways and that allow students to consider the problem solving processes used. They also need a problem solving context in which feedback is immediate and the cost of each trial is low.

Genuine Problems with a Variety of Solutions

Using computer programming as a context for problem solving allows the teacher to present problems that can lead to a variety of solutions and in which students can become immersed.

Imagine students given Scratch code below which creates two sides to a right angle triangle:

Screen Shot 2016-09-22 at 7.20.45 PMHow will students complete the triangle? They will need to determine the angle of rotation and the distance to travel back to the starting point. There are several ways to solve this problem and students can now experience these possible solutions in a concrete manner.

Screen Shot 2016-09-22 at 7.21.28 PMThis program provides an example of how the computer programming environment serves as a tool to help students think.

Screen Shot 2016-09-22 at 7.21.35 PMRecently a colleague of mine, upon receiving a new dash robot for her school, tweeted the following:

Screen Shot 2016-09-22 at 7.21.45 PMIn terms of problem solving, this is an enlightened view of robotics and the programming context, they are in fact our teaching partners.

Immediate Feedback and Low Cost of Error

The computer programming environment allows for students to try out solutions and be given immediate feedback. While other contexts would require teacher feedback, debuggers in the programming environment and the immediacy of observable outcomes allow errors to be identified quickly.

Screen Shot 2016-09-22 at 7.21.57 PMEssentially, the computer programming environment serves as a laboratory in which students can test hypotheses, observe results, draw conclusions … and then start again.

The image below shows a small program written in python as well as the python debugger’s feedback explaining that a division of 0 will take place and that this code needs to be changed:

Screen Shot 2016-09-22 at 7.22.08 PMThis immediate feedback means that the cost of each trial, in terms of time, is low. This leads to more problem solving attempts and allows the student to own and accept their errors. Students no longer see the errors as end points, but instead starting points for new iterations.

Having taught computer programming for over thirteen years, I am still amazed at the student engagement and dedication committed to the problems assigned in our class. The completion of programs becomes an iterative process. Students plan and design solutions but rarely expect their first attempt to work. Constant refinement of each iteration brings them closer to their end goal. Even when a project is complete, many students will mention, a few days later, that they’ve thought of a better way to implement their solution. This indicates to me an honest and authentic commitment to the problem solving process.

Steven Floyd (B.A., B.Ed., M.Ed.) is a High School Computer Science and Computer Engineering Teacher in London, On. He is the Lead Mentor for FIRST Robotics Team 5288 and the Lead Teacher for his school’s Specialist High Skills Major program in ICT. As a father of three boys under eight years old, he attempts to solve problems every day and is quite experienced in the area of failure and reiterative techniques 🙂