Technology and Engineering Education, Computer Science
Material Type:
Activity/Lab, Lesson, Lesson Plan
Upper Elementary, Middle School
  • Lesson Plan
    Creative Commons Attribution Non-Commercial
    Media Formats:
    Interactive, Text/HTML

    Reverse Engineering with Scratch or CSFirst

    Reverse Engineering with Scratch or CSFirst


    This lesson is for students who are very familiar with CSfirst or Scratch, and is intended to deepen and assess their familiarity with the blockly code language used in both. First the class discusses what "reverse engineering" is and why is is beneficial to them. Then, they will work in groups to recreate an example scene playing on the main screen, one sprite at a time. At the end, the students will compare their work to the code from the example project and discuss any differences that make the code work better, worse, or more efficiently. They will share the link to their group project to turn it in.


    This lesson (designed originally for two 30-minute sessions) is for deepening and assessing students familiarity with the coding language used in CSFirst or, as well as practicing the concept of reverse engineering. The students will work  in small groups or partnerships to recreate the code of a chosen sprite


    Background for Teachers

    To teach this lesson, you will need an understanding of Scratch or CSFirst and the blockly language used. You will also want to view the example project first to make sure that the difficulty level is appropriate for your class, and be able to remix it to make any changes if necessary.

    Link to Scratch

    Link to CSFirst

    Step 1 - Goals and Outcomes

    The students will be able to 1) Identify the sequences and blocks in a Scratch Project, 2) recreate the project without seeing the code.

    Utah k-5 Computer Science standards (found on USBE site):

    Standard 5.CT.1 - Develop algorithms in computer programs to solve problems, including unique and repeeated sub-tasks within a lager program.

    Standard 5.AP.1 - Compare and refine multiple algorithms for the same task and determine which is the emost appropriate.

    Standard 5.AP.2 - Decompose problems into smaller, manageable tasks which may themselves be deconstructed and analyzed.

    Step 2 - Planning Instruction


    Student Background Knowledge

    Prior to this lesson, students will need to have an understanding of Scratch or CSFirst and the code language used. They will also need to know how to log in and start a new project, as well as change/add sprites, costumes, and backdrops.

    Strategies for diverse learners

     Students are working in small groups to identify the sequences, and can work in small groups or individually to recreate the project. Teacher uses a microphone and visuals to demonstrate the project. Both Scratch and CSFirst can be changed into other languages for ELLs.


    Step 3 - Instruction

    Day 1 Instruction:

    1. (2-3 min) Discuss “reverse engineering” and what it means (analyzing and breaking down something that already exists, and recreating it), and how it could help them learn to code.
    2. (5-8 minutes) Show the project (fullscreen), and model the process of choosing a sprite, saying what you see it doing (floats upwards, stops, waits, and floats down again), and deciding how to recreate it using the skills/blocks they already know how to use. Example script:
      1. "I'm going to start with the jellyfish."
      2. "What actions do I see it doing?" "I see it going up, pausing, then going down, and pasing again. I see it it doing the same sequence over and over again."
      3. "What blocks that I already know will cause these actions?" " I know the 'glide to" block will make the jellyfish move smoothly like in the example. I know the 'wait' block will make it pause."
    3. (3 minutes) group students and have them start the process on a sprite. You can choose to let the groups pick a sprite, oor you can assign them.
    4.  (10+ minutes) have students work together to recreate their sprite on scratch. If they finish, check it with them and have them start the process for another sprite.

    Questions to prompt students and give hints:

    • is it moving smoothly, or is it just appearing there?
    • on a graph, which axis is horizontal and which is vertical?
    • what event starts the sequence?

    Day 2 Instruction: 

    1.  (5 Min) review the process from day 1
    2. (15 min) have them reverse engineer as much of the original project as they can, either alone or in groups.
    3. (5+ min) Bring students back together, and show the code for the original. Ask who coded it differently or similarly. Pros and cons of each?
    4. (last 5 minutes) Have the groups name their projects with all the names in the group, and ONE person needs to send the link to the teacher to turn it in. You can use an online managment system like Google Classroom or Canvas, or email.

    Step 4 - Assessments



    1. When modeling/giving hints, ask the students "what do you see the sprite doing?", "what blocks or algorithms, that you already know, do this or something similar?"
    2. Monitor and observe students' projects, and give hints as needed
    3. Have 1 student from each group turn in links to the project with all the names in the title. Use the rubric attached to assess.