# Show me the math!

Where is the math in coding? As much as I think that the connections between coding and mathematics are obvious, I think that there is a process involved in noticing and noting when mathematical concepts are demonstrated–some are clearly in use in students’ code and are easy to notice; other concepts are also in use but are more difficult to identify. I have always liked to think that *code is thought made concrete*. One of the greatest benefits of students learning through coding is that their thoughts become concrete, visual, manipulatable, discussable, viewable, and so on. This single affordance of code written by students makes seeing the math and the thinking possible!

### Assessment for / as learning

Being in a teacher role and finding the mathematical and computational thinking in a student’s code in the midst of a group of busy students is not a simple process. I think it’s a skill, but one that can be learned and practiced.

Moreover, being in a learner (student) role in the classroom and finding the mathematical and computational thinking in one’s own code is also a skill and one that is worth practicing, as well.

When the teacher identifies mathematical concepts at work in a student’s code, and takes the time to notice it and have a conversation about those concepts, that’s *assessment for learning*. When the student identifies mathematical concepts at work in their own code, and takes the time to notice them and have a conversation about them, that’s *assessment as learning*. Each of these strategies should drive further learning, exploration, tinkering, and reflection. Both of these kinds of assessment need to be active all the time and structures need to be put in place to support them. Quality assessment for/as learning do not happen by accident.

### Finding the mathematics at work in student programs

Even to a beginning Scratch user (student or teacher), I think the following example from a project created by a grade 5 student called Marie (not her real name) is clear and compelling.

After a few sessions of playing with Scratch and learning how it works on a basic level, there was a student sharing session where she learned that Scratch can draw things with a pen. The class was challenged to draw two-dimensional figures using Scratch. She wanted Scratch to draw a triangle (that week, the class was also in the midst of constructing various triangles on paper with protractor, pencil and ruler). This is the first attempt by the student:

There is a good amount of mathematical thinking to notice and note here. Even though no triangle was drawn, the code clearly demonstrates that Marie:

- knows that the sum of the three angles of any triangle is 180
**°** - knows that an equilateral triangle has three sides of equal length and three equal angles, each 60
**°** - is trying to transfer the steps in her paper and pencil drawing strategy to the Scratch environment

Why didn’t it work? This did not need to be asked; Marie said this aloud to herself. But then, her mouse started to click the green flag over and over, faster and faster. Her screen looked something like this when that happened:

“Oh look! A hexagon!” Some students around her looked over to see what was going on. Marie then proceeded to change her code. Very quickly, it looked like this:

She had meant to draw an equilateral triangle but she managed to draw a regular hexagon instead. After a fair amount of excitement and sharing, I reminded her about what a student had shared during the one of the previous sessions about the repeat block.

Whatever the repeat block has in its mouth will repeat the number of times indicated. The result:

Repeat blocks and looping logic in code can be applied to various concepts. This example shows a geometry and spatial sense idea where specific regularity and repetition of line lengths and angles result in different figures. Let’s get back to the triangle. Marie was simply asked by her teacher after the discovery of the hexagon: Now, what’s going on with the triangle? Marie changed the 6 to a 3 in the repeat block:

So Marie and I had a conversation about her work. I asked: *“Where are the three 60 degree turns. They have to be there because I see them in the code. What is going on?”*** (see note below) This was enough of a prompt and an encouragement. Nothing was wrong with her thinking. But she realized pretty quickly that there was a difference between her drawing an equilateral triangle on paper and getting Scratch to draw one. Through some more conversation, she narrowed it down to something like: I am doing something extra when I draw it on paper that I left out in my code. Something was missing.

I came back to her about ten minutes later and saw that she made some revisions to her code and she had a protractor in her hand. She showed me something interesting. “I found the three 60 degree turns” she said. And there they were:

She explained that Scratch turns 60 degrees clockwise starting from whatever direction he was facing. Looking at the protractor, she could clearly see now that he needed to turn 120 degrees after drawing the lines each time. She changed the 60 to 120 in her blue turn block:

The great part of using Scratch as a tool through which students can learn concepts is that there is both a meaningful, logical experience in which a product was created as well as a safe, social component where other students or a teacher can have a conversation about the thinking and figuring out as it is happening.

“I’m going to write my blog post now,” Marie said. She knew that was always part of the process and a reflective blog post was a requirement not only for consolidation but also for later reflection during a future time when this experience could be used, transferred, incorporated, remixed, and so forth.

At the end of all this, I think I said something like: “Great! Can’t wait to read it. And I can’t wait to see what you do with the hexagon you made before!” Looking back at observations from the week before, not a single student in the class had accidentally created a hexagon when drawing a triangle using paper, pencil and a protractor. And I would be surprised if Marie did not know now, simply through hard play, that each interior angle of a regular hexagon is 120**°. **

This post was about Marie’s geometry project on Scratch as well as a few observations I made and conversations we had. But there was a whole class of other students exploring geometry through Scratch. Check out what Karanvir was doing with a right triangle:

** ** “Where are the three 60 degree turns. They have to be there because I see them in the code. What is going on?”** — I am always learning how to best converse and talk to students during their thinking and figuring out. My biggest goal is to not do the thinking for them, and more: how to spark, encourage and pose good questions that provoke or prompt thinking in different directions. There would be a long list of ways to respond to Marie at this point. In my opinion, one of the worst would have been something like: “Oh look – I think you need to put 120 instead of 60 in for your turns. Try that and see if you get a triangle.” This could easily be seen as helping the student be successful. I get that. But the point of the whole exercise is that the student learns that a tool like Scratch can help them to think, experiment, play, share and discuss.

Thanks for sharing. Always knew there was great thinking with coding and tech and this helps me define it for the next time my administrator asks.