Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
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.
The Student Lesson: Complete the activities for Mobile CSP Lesson 9.10 Debugging Pong.
- 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
The College Board's AP Classroom provides a question bank and Topic Questions. You may create a formative assessment quiz in AP Classroom, assign the quiz (a set of questions), and then review the results in class to identify and address any student misunderstandings.The following are suggested topic questions that you could assign once students have completed this lesson.
Suggested Topic Questions:
You can examine students’ work on the interactive exercise and their reflection portfolio entries to assess their progress on the following learning objectives. If students are able to do what is listed there, they are ready to move on to the next lesson.
- Interactive Exercises:
- Portfolio Reflections:
LO X.X.X - Students should be able to ...
- In the XXX App, look for:
- Solutions to Pong with Bugs exercise
Differentiation: More Practice
If students are struggling with the lessons, they should explain in their own words how the app is supposed to work and identify what is not working. If needed, they can review the code from the completed Pong game.
Students can introduce their own bug to the Pong game and then have a partner try to debug it.
Teaching Tips: Debugging
Debugging is a very common programming practice that should be emphasized throughout the course. However, in order for students to be effective debuggers, they must first understand how the program is supposed to work. If they are struggling, have them describe out loud how the program should work and then identify what is not working correctly.
9.10.2. Professional Development Reflection¶
Discuss the following questions with other teachers in your professional development program.