This week we are immersing computer science across the elementary curriculum at Bugg Elementary in Raleigh, NC. Each day we will be teaching new and existing lesson ideas that engage students in their regular classroom content areas with a coding twist. Students will use CodeSnaps to explore their mastery of content in fun, engaging lesson ideas. We will culminate each day in a Bugg Report to capture the day's lessons and share some of our #HourOfCode / Computer Science Education Week adventures. So follow along!
Day 5: Science & Loops
Today, we engaged students in their recently acquired knowledge of seasons in their science coursework. While discussing facts and properties of seasons, students wrote programs to navigate a Sphero robot through the four seasons.
Although the navigation and resulting program is quite simple, it is a relatively long and repetitive program. It’s an ideal scenario to introduce loops. To begin, we defined loops by forming a circle and having a student clap once, followed immediately by a clap from the student to their left, and so on until every student had clapped. This represented one loop. Students were then instructed to traverse the loop several times. This provided ample opportunity to identify 1) how much better computers are at repetitive task than humans, 2) computers never get bored of repetitive tasks while humans often do, 3) computers can do it faster than humans ever could, and 4) loops can control repetitive programming tasks with a few lines of code. We culminated the introduction to loops with this video from code.org.
Bringing this newly acquired knowledge of loops back to the seasons activity, we worked as a whole class to assemble the MOVE FORWARD, TURN RIGHT, AND SET COLOR blocks into a loop such that 4 lines were needed, compared to the 12 the students assembled at the onset of the activity. To increase the “boringness” and length we created an outer loop to run the inner, seasons loop for each year of age of the students (See the code and video below.). Thus creating 5 lines of code that would have taken 72 lines without loops.