
9.10. Debugging Pong (Optional)¶
This lesson revisits the Pong game. Now that students understand how it should work correctly, they find bugs in a game that doesn't work correctly. Before, the listen to a presentation that describes what debugging is as well as the different types of bugs in programs. The lesson reinforces their understanding of what it means for a program to work correctly.
Professional Development
The Student Lesson: Complete the activities for Mobile CSP Lesson 9.10 Debugging Pong.
Materials
- Slides on Debugging
- Projection system and computer lab
- Android devices or emulator
9.10.1. Learning Activities¶
Estimated Length: 45 minutes
- Hook/Motivation (10 minutes): (Think-Pair-Share) Show a sample of App Inventor code to students and ask them to write down what they think the code is supposed to do and what it actually does. Have them share answers with a partner and with the class. The example below is from a Space Invaders game with a Sprite for one of the invaders, which moves similar to the Android in AndroidMash. The MyCanvas property should be Width instead of BackgroundImage. For this example, make sure everyone in the class knows what happens in the Space Invaders game.
- Experiences and Explorations (25 minutes):
- Explanation (10 minutes): Either use the slides to present concepts on debugging or have students watch the video.
- Debugging (15 minutes): Have students download the Pong with Bugs app and try to find the three errors. The students should do any necessary tests to determine what the bugs may be. Point out that their knowledge of how the Pong Game works will help them find any errors. The students should make incremental corrections. After attempting to fix one bug, the students should test the app before continuing.
- Rethink, Reflect and/or Revise (10 minutes): Review the debugging strategies and syntax vs. semantic errors. Have students complete the interactive exercises and portfolio reflection
9.10.2. Professional Development Reflection¶
Discuss the following questions with other teachers in your professional development program.