Skip Navigation

Deconstructing Code

By Kassandra Lenters + Jaci Banton 20 minutes
Level
Grade 7-8
Subjects
English Language Arts,
Mathematics
components
  • Programming
  • Computing and Networks
Tools & Languages
Block-based,
Scratch,
Unplugged

Key Coding Concepts

  • Conditional Statements
  • Events
  • Loops

Terminology

Debugging

Finding problems in code and solving them.

In this activity, learners practice interpreting code by acting out printed algorithms in small groups, then work to debug (or fix) the code together as a class.

Prerequisites

This activity requires some space to move around.

Technology

  • Computer with internet access (or the Scratch offline editor installed)

Before the lesson…

  • Review key coding concepts and ensure you are confident describing them to your group
  • Print/scan the Decode Sheets for the main activity (1 per group of 6)
  • Cut out the Decode Sheets ahead of time

Activity:

  1. Divide the class into groups of 5-6.
  2. Give each group a stack of the cut out decode sheets.
  3. Instruct each learner to take one paper (#1-6) - No peeking!
  4. Learners will try to ‘decode’ or interpret the code on their paper by acting it out. *Note: Group participation may be required
  5. Instruct learners to begin with a high-five (to replace the “When sprite is clicked” or “When space key is pressed” events).
  6. If learners try acting it out but get stuck, they can ask their group for help.

Closure:

  1. All of the code that we looked at are originally from a project in Scratch!
  2. Check out the original project.
  3. Click “See Inside”
  4. Go through each number: Select the character from the Sprites area to see the code, then do what it says (e.g. click on it or press the space key).
  5. For each, ask the learners that were assigned this number if this is what they ‘decoded’ when they acted it out.
  6. Point out Events (Orange ‘hat’ blocks that tell us when to begin), Loops (yellow “C” shaped blocks that make things happen more than once), and Conditional statements (yellow “IF, THEN” blocks that only happen IF something is true).
  7. Note: One of the sprites doesn’t do anything when we click on it (#4) - Why not? Try to debug (fix it) together. What does this tell us about computers? (They take things very literally! We need to give them super clear instructions).

Learning Outcomes

  • Computers need very clear instructions in a specific order (or sequence).
  • Events tell the computer when to start executing code.
  • Loops make things happen more than once.
  • Conditional statements control IF something happens or not.
  • Sometimes computers don’t understand our instructions, and we need to debug (or fix) the code.

Plugged-in: If you have access to computers, instruct learners to create their own algorithms in Scratch. Then, have a partner try to decode and act out their instructions before seeing how the sprite actually interprets the code.

Unplugged: Alternatively, print out large paper versions of 5-10 different blocks from Scratch and have learners put them together like puzzle pieces. Then, have another learner decode their algorithm by acting it out. Individual blocks can be printed from a file located on this ScratchEd site.

Computing and Networks: Ask learners if they can name any programming languages. Discuss how Scratch uses block-based programming to give instructions to the computer. Discuss how learning programming languages is similar to learning French or another language. Show learners this video on Programming Languages. Have them reflect about what they learned being the “programmers” in this activity. Ask if they have any additional questions about programming languages.

Research: Have learners research the History of Computer Programming Languages or Early Computer Programmers. To provide some history for learners in grades 4-6, consider obtaining a copy of “Grace Hopper Queen of Computer Code” written by Laurie Wallmark and illustrated by Katy Wu (or view a read aloud here)

Vector Scratch Blocks (ScratchEd)
http://scratched.gse.harvard.edu/resources/vector-scratch-blocks

Computer Science Basics: Programming Languages (GCFLearnFree.org)
https://www.youtube.com/watch?v=Y_9t3eQFmU4&feature=youtu.be

Read Aloud Grace Hopper Queen of Computer Code Written by Laurie Wallmark and Illustrated by Katy Wu (Readalotamus Books Read Aloud)
https://www.youtube.com/watch?v=j2hv1Dm4t0A&feature=youtu.be

Teach lessons that are tied to your existing curriculum! https://bit.ly/CLClessons

r

More Lesson Plans For Grade 7-8

    View All Lesson Plans

    Explore lessons based on components

    The K-12 Computer Science Framework

    Although learning how to build digital projects is a key part of Computer Science education, students should also learn a wider set of skills and competencies that will help them to harness the power of digital technologies as both creators and consumers. A comprehensive approach to K-12 Computer Science education includes learning about the following five focus areas:

    View Framework ➝

    Programming

    By the end of high school, students should be able to create a simple computer program.

    Computing and Networks

    By the end of high school, students should understand and be able to use the tools and devices commonly used to build digital projects.

    Data

    By the end of high school, students should be able to explain how we use computers to create, store, organize, and analyze data.

    Technology and Society

    By the end of high school, students should be able to explore the ways in which technology and society have mutually shaped each other.

    Design

    By the end of high school, students should be able to apply design principles to the digital projects they create.