Students will be able to:
- Define algorithm
- Construct algorithms for performing simple tasks
- Identify real-world examples where algorithms are used
Materials and Preparation
- Computers if teaching online / hybrid
- Internet access if teaching online / hybrid
- Synchronous online meeting tool such as Zoom or Bluejeans if teaching online and completing the lesson with the class
- Asynchronous such as Google Classroom if teaching online but recording the instructions for students to complete on their own
- Large poster paper and markers for students to write out their ingredients
- option to submit ingredients list via word doc, online whiteboard, google docs, etc.
- Materials for the sandwich activity either at home or in the classroom
- sandwich ingredients such as peanut butter & jelly
- utensils such as a knife and spoon
Terms introduced you may want to add to a classroom Word Wall either online or in person.
|Algorithm||A complete, well-defined sequence of steps for completing a task or solving a problem.|
|Computer||An electronic machine that can solve different problems, process data, store & retrieve data and perform calculations.|
|Computer Science||The study of the principles and use of computers.|
|Computer Program||A sequence of instructions or steps, written in a language that can be understood by a computer, that will be used by the computer to complete a task or solve a problem.|
|Debug||A process of locating and removing computer program bugs, fixing errors or abnormalities.|
|Programming Language||A vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks.|
Lesson Plan Pacing for a 55 Minute Lesson
|5 minutes||Welcome, attendance, bell work, announcements|
|10 minutes||Introductory discussion; present activity|
|10 minutes||Students write first algorithms|
|5 minutes||Sample algorithm execution|
|10 minutes||Students debug/rewrite algorithms|
|5 minutes||Second sample algorithm execution|
|10 minutes||Debrief and wrap-up|
- Invite students to discuss what is a computer, what do they do, and what they think computer science is
- Create a group document either online or in person defining the following terms (use the word wall as a guide)
- algorithm, computer science, computer, program, programming language
- Display these definitions in your classroom, either in person on a poster or online on a slide, for example, during the lesson
- For some context and interest to grab students attention, you can talk about the fact that the first computers were actually humans, where they were people who made calculations with the aid of a calculating machine
- Read the story about Katherine Johnson, whose calculations were used for manned and unmanned orbital mission
- In pairs or small groups, students will attempt to develop an algorithm or an ordered list of instructions to teach a robot to brush their teeth, or to prepare a peanut butter and jelly sandwich (check for food allergies before performing this exercise). Specify to students that their algorithm must be complete and detailed enough for a “computer” (the teacher) to unambiguously follow the steps and achieve the desired result.
- “Algorithms” or the steps should be written on paper or in the shared google doc or whiteboard to be shared and reviewed.
- After groups have finished, choose a group and have them read their instructions. Act as a computer and follow each step as literally as possible. If there is ambiguity, or if a step is not possible to complete, point out the error.
- When an instruction is ambiguous or impossible, interpret the algorithm in the most atypical (and hilarious) way possible. This will reinforce to students that many seemingly clear instructions can be taken many ways.
For the PB&J activity, common errors will include:
- Failing to open a container before using what is inside
- Response: Try (and fail) to access the inside in a humorous fashion (e.g. try to reach through the bag or jar, acting confused as to why you cannot reach the ingredient inside)
- Failing to specify in which orientation or position to use something (e.g. “grab the knife” but not by the handle, “put down the bread” but not on the plate)
- Response: use or place the ingredient in an obviously (and humorously) incorrect way (e.g. grab the knife (carefully) by the sharp end, put the slice of bread on the table next to plate, spread peanut butter around the crust instead of on the face)
- Using instructions that are too broad (e.g. “pick up the bread” to mean a single slice, “put the peanut butter on the bread” to mean spreading a small amount)
- Response: Ask for more detail, or interpret the instruction literally
- Combining multiple steps into one instruction (e.g. “spread peanut butter on the bread” without specifically opening the jar, putting peanut butter on the knife, using the knife to spread, etc.)
- Response: Ask for more detail
Most algorithms will fail. If there is time, repeat the process with one or two other groups.
Debugging / Fixing Algorithms
- Spend a brief moment explaining that programming is the language of computers, and that, like writing in english, some errors are expected before the final product is produced. Fixing grammatical errors in computer programming is called “debugging”.
- Have the students fix or “debug” their algorithms and attempt to fix all errors and vagueness.
- Track changes or other visual editing techniques on Word or Google Docs will show the teacher the thinking process.
- On paper, using a different colour pen to make changes will show their edits
Executing or Testing the Algorithm
- Once students are done debugging, execute, or try the algorithm again
- Hopefully, at least one group will have a functioning algorithm. If not, make changes on the fly and request a fix before proceeding. The goal is to create a sandwich before the end of class
- Many algorithms will still have similar problems to the first iteration. Others will have too much detail (see below) or other, subtler problems (such as skipping trivial steps like putting the two slices of bread together). Try to take note of issues while circulating so you can address them quickly.
- Ask students why there were problems in the first round, and how those problems were fixed. Encourage students to collaborate and add to a collective online document or poster. The use of computer science terminology (debugging, execution, algorithm, etc.) is encouraged
- Have students discuss what lessons can be learned from this activity and how they can be applied to programming and computer science
Accommodations and Differentiation
- Check for food allergies before letting students build their own sandwiches either at home or in the classroom
- Instead of peanut butter, you can use cream cheese & jelly, toast with butter and jam, or a deli sandwich with mayo or mustard. Students do not have to make a physical sandwich, as the focus is on the order of instructions (the algorithm)
- This is an option for students to make their “sandwich” out of clay, a cartoon drawing, or slips of paper with the words written. Be creative!
- If students are struggling with the level of specificity, accommodate and allow for basic assumptions to be made to ease the process to enable all students to come away with an understanding of what an algorithm is
- In the “debugging” round, some students may go overboard with the level of detail in an attempt to resolve all possible ambiguities. Remind these students that there are some basic instructions that can be easily understood by most people, and there is no need to go into further detail in those cases.
- If you feel students can handle the discussion, you can draw a parallel to machine code and abstraction