- Grades 1 - 2
- Beginner level
- 8 lessons
- Tynker Blocks
- Web iPad
- 8 lessons
- 48 activities
- Enhanced Creativity Tools
- Automatic Assessment
- Tutorials and Reviews
- Coding Puzzles
- DIY Projects
- Answer Keys
No previous coding experience required.
Course: Space Cadet
Lesson 5: Glitchy Code
Number of Levels: 6
Time: 30+ mins
IntroductionThe puzzles in this lesson introduces students to debugging, which is the process of finding and fixing programming errors. In each puzzle, students are given a puzzle and a piece of code that has a bug in it. Students will need to fix the bug so the character can do what they are supposed to.
New Code Blocks
- Debugging: The process of finding and fixing programming errors
- Bug: An error in a piece of code
- Apply coding concepts to troubleshoot and debug programs
- iPads (with installed Tynker app), computers, or laptops
Warm-Up (5 minutes)Pair up students and ask them to discuss the following:
- If your code doesn't work, what can you do to fix it? (Answers: Remove all code blocks and start over, break down your code, think out loud through your steps, ask the teacher/a friend for help)
- Have you ever gotten stuck on a coding puzzle and felt frustrated? What are some strategies you used to lower your level of frustration?
Activities (30 minutes)Facilitate as students complete all Glitchy Code modules:
- Inform students that this lesson has 6 levels that they need to complete.
- Tell students that the puzzles have already been solved, but the solutions are glitchy! They will need to analyze the provided code and fix the bug.
- Are students struggling? Here are different debugging strategies your students can try:
- Run the buggy code to see what happens. Next, modify the code.
- Read through the buggy code and use a finger to trace what should be happening to the character as each code block is executed. Also encourage students to say the steps out loud.
- Ignore the buggy code and write out what their character needs to do. Then compare that code to the buggy code.
- Make sure students understand how to change the parameter of the "repeat" block: Tap the value (e.g., 5). Next, select a different value (e.g., 7).
- Debugging Answer Key:
- Level 1: Increase the value in the "repeat" block from 5 to 7.
- Level 2: Decrease the value in the "repeat" block from 4 to 3. Add a "walk" block after the "repeat" block.
- Level 3: Increase the value in the "repeat" block from 2 to 3. Switch the order of the "jump" and the "walk" blocks inside the "repeat" block by dragging the "walk" block up.
- Level 4: Increase the value in the "repeat" block from 2 to 3. Add a "walk" block before and after the "repeat" block.
- Level 5: Add a second "repeat" block with a value of 3 and containing a "walk" block.
- Level 6: Increase the value in the "repeat" block from 2 to 3. Next, add a second "repeat" block with a value of 3 and containing a "walk" block.
Extended Activities (10 minutes)Discussion
Ask your students…
- What does it mean to "debug" your code? (Answer: Find and fix programming errors)
- What is a "bug"? (Answer: An error in code)
- Why is it important to learn how to debug a program?
- CCSS-Math: K.CC.B.4, K.CC.B.5, 1.OA.B.3, 2.OA.B.2, MP.1
- CCSS-ELA: RF.K.4, RF.1.4, RF.2.4, RF.1.4.A, RF.2.4.A, 1.RI.10, 2.RI.10
- CSTA: 1A-AP-09, 1A-AP-10, 1A-AP-11, 1A-AP-14
- CS CA: K-2.AP.12, K-2.AP.13, K-2.AP.16
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b
U.K. StandardsKey Stage 1
- Use logical reasoning to predict the behaviour of simple programs
- Use technology safely and respectfully, keeping personal information private; identify where to go for help and support when they have concerns about content or contact on the internet or other online technologies
- Design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.
- Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs.
- Understand computer networks, including the internet; how they can provide multiple services, such as the World Wide Web, and the opportunities they offer for communication and collaboration.
- Use technology safely, respectfully and responsibly; recognise acceptable/unacceptable behaviour; identify a range of ways to report concerns about content and contact.