6.8. Debugging Caesar Cipher

This lesson reviews debugging and has students debug a Caesar Cipher app with 5 bugs in it. The lesson reinforces their understanding of what it means for a program to work correctly.

CSP Framework
Big Idea 1: Creative Development (CRD)
Enduring Understanding CRD-2: Developers create and innovate using an iterative design process that is user-focused, that incorporates implementation/feedback cycles, and that leaves ample room for experimentation and risk-taking.
Learning Objective CRD-2.I.a: For errors in an algorithm or program: a. Identify the error.
Learning Objective CRD-2.I.b: For errors in an algorithm or program: b. Correct the error.

Professional Development

The Student Lesson: Complete the activities for Mobile CSP Unit 6: Lesson 6.8 Debugging Caesar App.

Materials

6.8.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 lightbulb in the Lights Off app. 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 buggy app and try to find the 5 errors. The students should do any necessary tests to determine what the bugs may be. The students should make incremental corrections. After attempting to fix one bug, the students should test the app before continuing. If they need hints, tell them to first look at encryption, then decryption, tell them to pay attention to how many times each loop is run in these functions and their return values. They can also compare their code to their finished Caesar app from the last lesson.
      Here are the solutions to this debugging exercise.
  • 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

6.8.2. Professional Development Reflection

Discuss the following questions with other teachers in your professional development program.

    I am confident I can teach this lesson to my students.
  • 1. Strongly Agree
  • 2. Agree
  • 3. Neutral
  • 4. Disagree
  • 5. Strongly Disagree