This summer, I had my first student, Chaz, complete all of the Osmo Coding Awbie classes. I wanted to take a moment to put a spotlight on him and also share my experience with working with him.
Chaz and Evelyn
Chaz is one of my former co-worker's son. My co-worker, Evelyn, is one of the most positive people I have ever met. I never worked on a project with her, but I used to pass her cube every day. She always had some inspirational quote or piece of advice on her white board. I loved every word she wrote and it would always brighten my day. I was so excited when she told me she was enrolling her son. It also gave me a chance to get to know her better.
Chaz, like his mother, is one of the most enthusiastic people that I've met. Each day he would come to class with a smile. The only disappointment he felt was when it came time to leave.
Like almost all of the children I see, Chaz had little experience with coding. He took to it very well and with each day that passed, I noticed how much he improved. I also loved seeing his eyes light up when we talked about loops and how I related them to multiplication. It turns out that Math is Chaz's favorite subject. I explained that loops mean that you repeat a series of steps. I laid out 8 strawberries in a straight line.
I then asked him if to solve this equation: 2 x ? = 8. He, of course, knew that the answer was 4. Then I showed him how we would build this equation using a loop.
We will need to take 4 steps forward and then repeat, or "loop" through, that command. In Osmo, if there is no number after a command, then we assume 1 and that the command gets done once. A loop without a number indicates that you would repeat the steps once. So all of the steps underneath the "loop" symbol would be done a total of 2 times. So 2 x 4 = 8.
Each pass of a loop is called an iteration. In Osmo, we count each iteration starting with 0. This means that if I want to count the total number of times the steps get done, I will need to add 1 to whatever number comes after the loop. In the following example, we will walk forward 2 steps and then repeat this 3 times. Therefore, we have a total of 4 iterations (1 initial pass + repeat 3 times). So 4 iterations of taking 2 steps = 8 strawberries!
The next day, I played this same game with my daughter. I had tried to teach her multiplication before, but something wasn't clicking. So I decided I would teach her about loops and she had an epiphany...Something clicked in her brain and she was able to do simple multiplication. She was even able to understand that 2 x 3 yields the same result as 3 x 2 and that 2 x 4 = 4 x 2!
Please note that when you have more than 1 command to be repeated in the loop, then the correlation between multiplication and loops gets trickier to explain. It is also worth noting that Scratch (a popular video game developed by MIT to teach coding) treats loops differently. In Scratch, the number after the loop or repeat symbol represents the total number of iterations.
More about Loops
Afterward, I laid out this board:
In order to pick up these strawberries, we will need to:
1) Walk forward 2 steps
2) Walk right 1 step
3) Repeat steps the above steps 2 more times
If we build out the commands without using loops, it looks like the following 6 lines of code:
I then asked if Chaz recognized a pattern, and of course, he noticed the repetition of the steps. So then, we build the same steps but this time we used loops:
Using loops, we have reduced the number of lines of code from 6 to 3!
What I learned
When I first started teaching Chaz about loops, I instructed him to lay out the command first and then put the loop on top. He always had a tendency to put the loop on first and then would build the command inside the loop. I corrected him 2 times, but then I realized....wait...I shouldn't be correcting him. There isn't just one way to solve this problem, and people have different ways of coming up with the same answer.
Even with something as simple as 10-7=?, there are different ways to skin the cat. I think of 10 objects and then taking 7 away and counting how many I'm left with. Other people might start with 7 and ask "how many more objects do I need to make 10?". Both methods result in the same answer. I just have to remind myself that people may take different paths to arrive at the same conclusion.
He aced it!
For the next few days, we talked about functions and conditional statements. Chaz became better and better with each day. He not only built the loops, functions, and conditional statements without my help, but he also began to recognize when we needed them. Not bad for 4 days of classes. I hope that he continues to pursue more classes in coding and I was honored to introduce him to the basic concepts of coding.