Compression Code

This is an introductory activity used before teaching scientific notation and exponents. Students will learn about compression coding and practice and apply that skill. Ideally this will be taught the day before the teacher introduces scientific notation.

Author: Kristy Barr
Grade Level: 6-8
Standards Framework: CCSS Math, Wyoming CS
Standards: 8.EE.B.3; 8.AP.N.01-2
Materials: Website, Youtube

OVERVIEW

Activity Overview:

This is an introductory activity used before teaching scientific notation and exponents. Students will learn about compression coding and practice and apply that skill. Ideally this will be taught the day before the teacher introduces scientific notation.

Meta description

  • Subject Area: Computer Science, Mathematics, Music
  • Grade Level : 6-8
  • Computer Science Domains:
    • Algorithms and Programming
  • Computer Science Principles:
    • Collaborating Around Computing, Recognizing and Defining Computational Problems, Creating Computational Artifacts, Communicating About Computing
  • Materials:
    • Website, Youtube
  • Considerations:
    • Students will need to know songs that have a repeated phrase.

Lesson Plan

Overview

This is an introductory activity used before teaching scientific notation and exponents. Students will learn about compression coding and practice and apply that skill. Ideally this will be taught the day before the teacher introduces scientific notation.

ASSESSMENT PRE/POST-TEST

What is a compression code and why would I need to use that in the real world?

OBJECTIVES

The students will understand what a compression code is and why it is needed. The students will practice using a compression code.

CATCH/HOOK

Intro: Share the chorus from a few songs that have repeating phrases in them. For example: “Give it Away” by Red Hot Chili Peppers; Da Da Da by Trio; Na Na Na by My Chemical Romance. Discuss what they have in common. (repeated words or phrases) Ask: How can this relate to computer programming? (Guide discussion to longer files of code and trying to move them. Use real world examples such as vacuum bags to store blankets in, etc.)

ACTIVITY INSTRUCTIONS

Big files take a long time to transfer from one place to another. The more data you have the longer it takes and the more memory is needed to store the information. We, therefore, compress files first. Has anyone ever seen a zip file? Data on computers is stored as long sequences of characters. The idea with compression is that we use an algorithm to change the way the information is represented so that fewer characters are needed to store the exact same information.

That involves special codes. Each common word or phrase is replaced by shorter sequences of symbols. A long file can be made much shorter if it has lots of similar sequences. A second algorithm can be used to get the original back. We’ve turned this idea into a puzzle that involves pattern matching patterns from the code book. Can you work out what the original messages were?

For example: 32223111

Codebook: 1 [Da] 2 [Do] 3 [De]

By replacing the 1s in the message with “Da”, 2 with “Do” and 3 with “De” we would get the title of a 1980s song from the group The Police!

Next, as a class, practice using the songs from the introduction using 1, 2, 3, etc. as your code. Then get in groups of 3-4 and come up with one song that has a repeated word or phrase and practice. After a few minutes, have groups share their codes.

Homework: Practice the compression code puzzle

Supplements

Any items in this section are the property & under the license of their respective owners.

REVIEW

Exit slip: In 2-3 sentences write: What is a compression code and why would I need to use that in the real world? GIve at least one real world example.

STANDARDS

TypeListing
CS DomainsAlgorithms and Programming
CS PrinciplesCollaborating Around Computing, Recognizing and Defining Computational Problems, Creating Computational Artifacts, Communicating About Computing
Other Content Standards8.EE.B.3; 8.AP.N.01-2