Lesson 3: Relay Programming
This activity will begin with a short lesson on debugging and persistence, then will quickly move to a race against the clock as students break into teams and work together to write a program one instruction at a time.
Teamwork is very important in computer science. Teams write and debug code with each other, instead of working as individuals. In this lesson, students will learn to work together while being as efficient as possible.
This activity also provides a sense of urgency that will teach students to balance their time carefully and avoid mistakes without falling too far behind. This experience can be stressful (which is expected!) Make sure you provide students with the tools to deal with potential frustration.
Warm Up (15 min)
Main Activity (20 min)
Wrap Up (15 min)
Students will be able to:
- Define ideas using code and symbols.
- Verify work done by teammates.
- Identify signs of frustration
- Watch the Relay Programming - Teacher Video.
- Locate a wide open space for this activity, such as the gym or outdoor field.
- Print out one Relay Programming - Activity Packet for each group.
- Supply each group with plenty of paper and pens/pencils.
- Print one Relay Programming - Worksheet for each student.
- Make sure every student has a journal.
Heads Up! Please make a copy of any documents you plan to share with students.
For the Teachers
- Relay Programming - Worksheet Answer Key
- Relay Programming - Teacher Debugging Image
- Relay Programming - Teacher Video
For the Students
- Relay Programming - Worksheet
- Relay Programming - Unplugged Video (download)
- Relay Programming - Activity Packet
- Algorithm - A list of steps to finish a task.
- Bug - Part of a program that does not work correctly.
- Debugging - Finding and fixing problems in an algorithm or program.
- Frustrated - Feeling annoyed or angry because something is not the way you want it.
- Persistence - Trying again and again, even when something is very hard.
- Program - An algorithm that has been coded into something that can be run by a machine.
Warm Up (15 min)
Recall that in "Graph Paper Programming" we guided our teammate's Automatic Realization Machine (ARM) using arrows. This warm up will bring back these ideas, which will be needed in the main activity.
Where did I go wrong?
Goal: In this lesson, we want to help students learn to identify and fix bugs in their own programs. The easiest way to do that is to first present students with a program that contains bugs that are not their fault. Once they've helped you fix "your" program, share with them how frustrating it can be to make mistakes, and help them see that those feelings are completely normal and they shouldn't feel embarrassed by them.
Display: Show your students the provided Relay Programming - Teacher Debugging Image.
Discuss: Get the attention of the class and let them know that you are stuck! You have this challenge, and you thought you had solved it, but it doesn't seem to be working. Your program has a bug, can they help you fix it?
Take a moment to walk them through the rules: - Start at the star - Follow the instructions step-by-step - End when all of the right squares are filled in
Optional: Follow along by filling in a blank grid. Express frustration when the picture doesn't turn out the way that you wanted it to.
Think: Can you figure out why my program doesn't work?
Pair: Let students work together to see if they can figure out what the program is supposed to say.
Share: Ask students if anyone was able to figure out a way to solve the problem. When you get a correct answer, let the students know that they are great at "debugging"!
For more on persistence and frustration, try reading Stevie and the Big Project to your students. It will help them spot moments of frustration. It will also help give them the tools to deal with it.
If you do not read the book, take a moment to cover tips on frustration and persistence as a class:
Tips to Help With Frustration
- Count to 10
- Take deep breaths
- Journal about them
- Talk to a partner about them
- Ask for help
Tips for Being Persistent
- Keep track of what you have already tried
- Describe what is happening
- Describe what is supposed to happen
- What does that tell you?
- Make a change and try again
Discuss: Ask the students if they could tell how you were feeling when you couldn't figure out the answer. They might suggest that you were "mad" or "sad". Instead of telling them "no", describe that you were feeling a little bit mad, a little bit sad, and a little bit confused. When you put all of those emotions together, it makes a feeling called "frustration". When you are "frustrated" you might think you are mad, sad, or confused -- and you might be tempted to give up -- but frustration is a natural feeling and it's a big hint that you are about to learn something! Instead of quitting, practice persistence. Keep trying over and over again. After a few times, you will start to understand how to debug your problems!
Distribute: To make sure that students understand the idea of finding and fixing errors (debugging) pass out the Relay Programming - Worksheet and have students complete the task in pairs.
Optional: If you want to move the activity along more quickly, feel free to complete these as a class, instead.
Transition: Now it's time to play the game!
Main Activity (20 min)
With Graph Paper Programming in mind, it's time to split up into teams and prepare to run the activity as a relay!
Set-Up: Prepare the Relay Programming - Activity Packet by printing out one copy for each team of 4-5 students. Cut or fold each page along the center dotted line.
Here are some clarifications that need to be shared from time to time:
- Only one person from each group can be at the image at one time.
- It is okay to discuss algorithms with the rest of the group in line, even up to the point of planning who is going to write what when they get to the image.
- When a student debugs a program by crossing out an incorrect instruction (or a grouping of incorrect instructions) this counts as their entire turn. The next player will need to figure out how to correct the removed item.
Go over the rules of the game with your class:
- Divide students into groups of 3-5.
- Have each group queue up relay-style.
- Place an identical image at the other side of the room/gym/field from each team.
- Have the first student in line dash over to the image, review it, and write down the first symbol in the program to reproduce that image.
- The first student then runs back and tags the next person in line, then goes to the back of the queue.
- The next person in line dashes to the image, reviews the image, reviews the program that has already been written, then either debugs the program by crossing out an incorrect symbol, or adds a new one. That student then dashes back to tag the next person, and the process continues until one group has finished their program.
First group to finish with a program that matches the image is the winner! Play through this several times, with images of increasing difficulty.
Go through the game as many times as you can before time runs out or your students begin feeling exhausted.
Transition: Once the game is over, circle everyone up to share lessons learned.
Discuss: What did we learn today?
- What if each person on a team were allowed to do five arrows at a time?
- How important would it be to debug our own work and the work of the programmer before us?
- How about with 10 arrows?
- 10,000? Would it be more or less important?
- Do you think a program is better or worse when more than one person has worked on it?
- Do you think people make more or fewer mistakes when they're in a hurry?
- If you find a mistake, do you have to throw out the entire program and start over?
Wrap Up (15 min)
Having students write about what they learned, why it’s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.
- What was today's lesson about?
- How did you feel during today's lesson?
- How did teamwork play a role in the success of writing today's program?
- Did you start to get frustrated at any point? What did you do about it?
Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment.
Pass the paper
- If you don't have the time or room for a relay, you can have students pass the paper around their desk grouping, each writing one arrow before they move the paper along.
Fill It, Move It
- As the teacher, draw an image with as many filled squares as children in each group.
- Have the students write as many arrows in the program as it takes to get to a filled-in square (including actually filling that square in) before passing to the next person.
Draw an image on the board. Have each student create a program for the image. Ask students to trade with their elbow partner and debug each other's code.
- Circle the first incorrect step, then pass it back.
- Give the students another chance to review and debug their own work.
- Ask for a volunteer to share their program.
Ask the class:
- How many students had the same program?
- Anyone have something different?
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
- 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
- 1B-AP-12 - Modify, remix or incorporate portions of an existing program into one's own work, to develop something new or add more advanced features.
- 1B-AP-15 - Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended.