Unit 2
Unit 2
1 1 2 3 4 5 6
2
Unit 2 - Digital Information
This unit explores the way large and complex pieces of digital information are stored in computers and the associated
challenges. Through a mix of online research and interactive widgets, students learn about foundational topics like
compression, image representation, and the advantages and disadvantages of different file formats. To conclude the unit,
students research the history and characteristics of a real-world file format.
Week 1
At some point we reach a physical limit of how fast we can send bits and if
we want to send a large amount of information faster, we have to find a way
to represent the same information with fewer bits - we must compress the
data.
Week 2
In this lesson students will conduct a small amount of research to explore a file format either
currently in use or from history. Students will conduct research in order to complete a "one-
pager" that summarizes their findings. They will also design a computational artifact (video,
audio, graphic, etc.) that succinctly summarizes the advantages of their format over other
similar ones.
Chapter Commentary
Key Concepts and Pedagogy
Increasing Focus on Research: Unit 2 includes an increasing focus on research skills students will use throughout the
rest of the course and eventually on the Explore PT. Researching computing topics is a challenging skill which students will
need to develop separately from the other skills and content knowledge. Lesson 5 and the Rapid Research activity in
Lesson 6 in particular explicitly review these research skills as students apply the knowledge they’ve developed elsewhere
in the unit to research the differences between familiar file formats.
A Familiar Pedagogy: Many of the lessons in this unit will feel similar to Unit 1 Chapter 1. Students will explore real world
concepts and problems in data representation through collaborative problem solving activities. This process is aided
through the introduction of two new widgets, the Text Compression Widget in Lesson 2 and the Pixelation Widget in
Lessons 3 and 4. As with the Internet Simulator, students can’t “break” these tools and so are encouraged to freely explore
them with minimal content frontloading to discover the concepts they highlight. In keeping with the “ABC CBV” approach,
technical vocabulary is only introduced only once these exploratory activities ensure all students have developed a shared
understanding of the concepts.
If you are interested in licensing Code.org materials for commercial purposes,contact us.
UNIT Ch. 1 1 2 3 4 5 6
2
Lesson 1: Bytes and File Sizes
Research
In this lesson students are introduced to the standard units for Objectives
measuring the sizes of digital files, from a single byte, all the way up
Students will be able to:
to terabytes and beyond. Students begin the lesson by comparing the
size of a plain text file containing “hello” to a Word document with the Use appropriate terminology when describing
same contents. Students are introduced to the units kilobyte, the size of digital files.
megabyte, gigabyte, and terabyte, and research the sizes of files they Identify and compare the size of familiar
make use of every day, using the appropriate terminology. This digital media.
lesson foreshadows an investigation of compression as a means for Solve small word problems that require
combatting the rapid growth of digital data. reasoning about file sizes.
Purpose Preparation
The simple purposes of this lesson are: You should verify that you know how to
look at the sizes of files on computers that
1. Get terminology out in the open your students are using (see activity).
2. Become somewhat conversant with file types and sizes For the getting started activity might want a
3. Grapple with orders-of-magnitude differences between things. Word processing program (such as MS
The 8-bit byte has become the de-facto fundamental unit with which Word) and plain text editor (such as Notepad
we measure the “size” of data on computers, and in fact, today most or TextEdit) open and ready.
computers only let you save data as combinations of whole bytes; The teaching remarks and content corners
even if you only want to store 1 bit of information, you have to use a in this lesson contain lots of little bits of
whole byte to do it. And many computer systems will require you store history that you might choose to share at
even more than that. Messages sent over the Internet are also various points in the lesson.
typically structured as messages with byte-offsets. KEY Bytes and File Sizes
Agenda Terabytes
If a single ASCII character is one byte then if we were to store the word “hello” in a plain ASCII text file in a computer, we
would expect it to need 5 bytes (or 40 bits) of memory.
What about a Microsoft Word document that contains the single word "hello"? How many more bytes will a Word document
require to store the word “hello” than a plain text document?
Discuss: Have students silently make their prediction, then share with a partner, then share with the group. Prompt a
couple students to share why they chose the size they did.
hello.txt - 5 bytes
hello.docx = 21,969 bytes
Remarks
The big difference in file size between .txt and .docx is due to the extensive formatting information included along with the
actual text in .docx. Modern data files typically measure in the Content Corner
thousands, millions, billions or trillions of bytes. Let's get a
little practice looking at files and how big they are.
NOTE: A 5-byte file is so small that some computers won't
allocate a chunk of memory that small. For example you
Review worksheet If nothing else, remember that terms like "megabyte" have
this little wiggle room in them between the 1024 and 1000
Share: Provide students an opportunity to clear up any based meanings. For purposes of CS Principles the
remaining confusion and share interesting pieces of distinction is not important - "about a million
information they came across. bytes" is a fine, close-enough interpretation for
"megabyte".
Review: Answers to the questions on the Activity Guide.
Foreshadow Compression Teaching Tip
Assessment
Use the last 3 questions on the activity guide for assessment.
Standards Alignment
CSTA K-12 Computer Science Standards (2011)
CT - Computational Thinking
If you are interested in licensing Code.org materials for commercial purposes,contact us.
UNIT Ch. 1 1 2 3 4 5 6
2
Lesson 2: Text Compression
Widget | Individual and Group Discovery
At some point we reach a physical limit of how fast we can send bits Objectives
and if we want to send a large amount of information faster, we have
Students will be able to:
to find a way to represent the same information with fewer bits - we
must compress the data. Collaborate with a peer to find a solution to a
text compression problem using the Text
In this lesson, students will use the Text Compression Widget to Compression Widget (lossless compression
compress segments of English text by looking for patterns and
scheme).
substituting symbols for larger patterns of text. After some
Explain why the optimal amount of
experimentation students are asked to come up with a process (or
compression is impossible or “hard” to
algorithm) for arriving at a "good" amount of compression despite the identify.
fact that there is no way to know what is best or optimal. In developing Explain some factors that make compression
a so-called "heuristic approach" to this problem, students will grapple
challenging.
with the tradeoffs in compressing data and begin to develop a sense
Develop a strategy (heuristic algorithm) for
of computing problems that are “hard” to solve.
compressing text.
Agenda
Getting Started (5-7 mins)
Warm up: Abbr In Ur Txt Msgs (5-7 mins)
Activity (45 mins)
Decode this Mystery Text (10-15 mins)
Use theText Compression Widget
Discuss properties and challenges with compression.
Activity 2 (30 mins)
Develop a heuristic for doing compression
What's best?
Wrap-up (20 mins)
Recap Questions
Compression in the Real World (.zip)
Assessment
Extended Learning
Teaching Guide
Getting Started (5-7 mins)
Warm up: Abbr In Ur Txt Msgs (5-7 mins)
Prompt:
Discussion
"When you send text messages to a friend, do Goal
you spell every word correctly?" As a warm up to thinking about Text Compression,
connect to ways that most people already compress text in
Do you use abbreviations for common words? List
their lives, through abbreviations and acronyms with which
as many as you can. most people have some experience in text messages.
Write some examples of things you might see in a
Motivate some ideas about why someone would want to
text message that are not proper English. compress text.
Give students a minute to write, and to share with a
neighbor?
The art and science of compression is about figuring out how to represent the SAME DATA with FEWER BITS.
Why is this important? One reason is that storage space is limited and you'd always prefer to use fewer bits if you
could. A much more compelling reason is that there is an upper limit to how fast bits can be transmitted over the
Internet.
What if we need to send a large amount of text faster over the Internet, but we’ve reached the physical limit of how fast
we can send bits? Our only choice is to somehow capture the same information with fewer bits; we call this
compression.
Transition:
Let's look at an example of a text message that's been compressed in a clever way.
To answer, we need to compare the number of characters in the original poem to the number of characters needed to
represent the compressed version.
Display or Demonstrate yourself ideas from: Activity Recap - Decode this Message - Activity Recap (shown in
table above)
Important Note:
The compressed poem is not just this part: If you were to send this to someone
over the Internet they would not be able to decode it.
The full compressed text includes BOTH the compressed textand the key to solve it.
Thus, you must account for the total number of characters in the messageplus the total number of characters in the
key to see how much you've compressed it over the original.
Transition
Now you're going to get to try your hand at compressing some things on your own.
Yes, but it’s imprecise -- you might leave this as a lingering question that leads to the next student task.
Vocabulary: heuristic a problem solving approach (typically an algorithm) to find a satisfactory solution where finding an
optimal or exact solution is impractical or impossible.
Instructions:
Continue working on compressing your poem using the Text Compression Widget. As you do so, develop a set of
rules, or a “heuristic” that generally seems to provide good results.
Record your heuristic as a list of steps that someone else unfamiliar with the problem could follow and still end up
with decent compression.
Share Findings:
Have one member of each group give a summary of their heuristic and the results on each of the poems. If time is limited,
these presentations can be done between groups instead in front of the entire class. The discussion questions below could
also be done group to group.
"Do you think it’s possible to describe (or write) a specific set of instructions that a person could follow
that would always result in better text compression than your heuristic? Why or why not?"
Some compression programs (like zip) do a great job if the file is sufficiently large and has reasonable amounts of
repetition.
However, it is also possible to create a “compressed file” that is larger than the original because the heuristic does work
in every single case.
"Is there a way to know that a compressed piece of text is compressed the most possible? If yes, describe
how you could determine it. If no, why not?"
Stress that there is no perfect solution.
The size and shape of the data will determine what the “best” answer is and we often cannot even be sure it is the best
answer (only that it is better than other answers we have tried.)
Pattern Recognition
Abstraction (patterns referring to other patterns)
"Will following this process always lead to the same compression? (i.e. two people following the process
for the same poem, will result in the same compression?)"
No. It’s imprecise, but still OK. The text still gets compressed, no matter what.
Since there is no way to know what’s best, all we need is a process that comes up with some solution, and a way to
make progress.
Zip works really well for text, but only on large files. If you try to compress the simple hello.txt file we used in a
previous lesson, you'll see the resulting file is actually bigger.
Zip is meant for text. It might not work well on non-text files very well because they are already compressed or don’t
have the same kinds of embedded patterns that text documents do.
Assessment
Code Studio: Assessment questions are available on the Code Studio
Extended Learning
Real World: Zip Compression
Experiment with zip using text files with different contents. Are the results for small files as good as for large files? (On
Macs, in the Finder choose “get info” for a file to see the actual number of bytes in the file, since the Finder display will
show 4KB for any file that’s less than that.)
Warning: results may vary. Zip works really well for text, but it might not compress other files very well because they
are already compressed or don’t have the same kinds of embedded patterns that text documents do.
While the idea behind the text compression tool is similar to LZW (zip) algorithm, tracing the path of compression and
decompression is somewhat challenging. Learning more about LZW and what happens in the course of this algorithm
would be an excellent extension project for some individuals.
Standards Alignment
CSTA K-12 Computer Science Standards (2011)
CL - Collaboration
CPP - Computing Practice & Programming
CT - Computational Thinking
If you are interested in licensing Code.org materials for commercial purposes,contact us.
UNIT Ch. 1 1 2 3 4 5 6
2
Lesson 3: Encoding B&W Images
Widget | Concept Invention | Individual Creation
In this lesson, students will begin to explore the way digital images Objectives
are encoded in binary. The class begins by asking students to invent
Students will be able to:
their own image encoding protocol in order to familiarize themselves
with some of the subtle complications of encoding images, namely the Explain how images are encoded with pixel
need for other data, called metadata, that describes properties of the data.
image necessary for rendering it. Students will learn about pixels, Describe a pixel as an element of a digital
raster images, and what an image file format is. Students will encode image.
binary image data using a widget in Code Studio. Encode a B&W image in binary representing
both the pixel data (intensity) and metadata
Purpose (width, height).
Create the necessary metadata to represent
The main purpose of this lesson is for students to exhibit some the width and height of a digital image, using
creativity while getting some hands-on experience manipulating binary a computational tool.
data that represents something other than plain numbers or text. Explain why image width and height are
Connections to abstraction in data can be made here. Connections metadata for a digital image.
can be made back to file sizes and file formats here as well - e.g. how
many bytes does it take to store an image v. text? If you want to Preparation
broach the subject, the concept of data compression can come in
here too - it is interesting to think about how a black and white image (Optional) Graph or grid paper for drawing
might be compressed. You should be aware that this lesson largely pixel images by hand
acts a stepping stone to the next lesson which addresses how RGB KEY B&W Pixelation Widget
colors are represented in binary. KEY Extension: Magnify an Image
(optional)
Image file types have some similarities to data packets we saw in the
Internet unit -- because images must include metadata, or data about Links
the data. The data of a black-and-white image is the list of bits that
represent whether each pixel is on or off. To create the image, Heads Up! Please make a copy of any
however, we must also know how wide and tall the image is in order documents you plan to share with students.
to recreate it accurately. This necessitates the creation of a file format
which clearly defines how this metadata will be encoded, since it is For the Teacher
crucial for interpreting the subsequent data of the image. It is similar to Teaching Tips & Tricks Video -
how an internet packet doesn't only contain the data you need to Encoding Images - Video (download)
send, but must also include metadata like the to and from addresses
and packet number. For the Students
B&W Pixelation Widget - Activity Guide
Digital images can be stored in many formats, but one of the most
Make a Copy
common formats is "raster". Raster images store the image as an
Extension: Magnify an Image (optional)
array of individual pixels, each of which has a particular color. Higher-
- Activity Guide Make a Copy
quality images can be obtained by decreasing the size of the pixels
B&W Pixelation Tutorial - Video
(resolution). While full color will be addressed in the next lesson, an
(download)
important idea here is that images on computer screens are created
Invent a B&W image encoding scheme -
with light by illuminating pixels on the screen. This is why it is typical
Activity Guide Make a Copy
in a black and white image for the value 1 to represent white - it means
turn the light on - and 0 represents black - light off. If you were
Vocabulary
drawing on paper you might do the inverse. Image - A type of data used for graphics or
pictures.
Agenda metadata - is data that describes other data.
Getting Started (10 mins) For example, a digital image may include
Invent An Encoding Scheme for B&W Images metadata that describe the size of the image,
number of colors, or resolution.
Activity (40 mins)
Pixel - short for "picture element", the
Video: The Pixelation widget
fundamental unit of a digital image, typically a
Wrap-up (10 mins)
tiny square or dot that contains a single point
Assessment of color of a larger image.
Extended Learning
Teaching Guide
Getting Started (10 mins)
Remarks
Back in the Internet Unit you encoded a line-drawing image as a list of numbers that made up the coordinates of the
points in the image. That works for line drawings, but how might you encode a different kind of image? Today we’re going
to consider how you might use bits to encode a photographic image, or if you like: how could I encode vision?
Today, we're going to start to learn about images, but we're going to start simple, with black and white images.
Prompts:
How have you encoded white and black portions of your image, what do 0 and 1 stand for in your encoding?
Are your encodings flexible enough to accommodate images of any size? * How do they accomplish this?
Is your encoding intuitive and easy to use?
Is your encoding efficient?
Remarks
Content Corner
Vocabulary: each little dot that makes up a picture
There is some mystery about the etymology of the word
like this is called a pixel. Where did this word pixel
"pixel". You can read more about it on the Wikipedia:
come from? It turns out that originally the dots were pixel page
referred to as "picture elements", that got shortened
to "pict-el" and eventually "pixel".
What we've discovered is that the data for our image file must contain more than just a 0 or 1 for every pixel. It must
contain other data that describes the pixel data.
This is called metatdata. In this case the metadata encodes the width and height of the image.
We've seen forms of metadata before. For example: an internet packet. The packet contains the data that needs to be
sent, but also other data like the to and from address and packet number.
NOTE: This video pops up the first time you visit the pixelation widget in Code Studio. You might perfer to have students
watch it there on their own.
The image is initially setup with the incorrect dimensions. Your first task is to set the second byte to the 8-bit binary code
for 5: 0000 0101. Then you can start entering pixel data to make the A.
Directions:
Activity Guide
Page 1:
Explains the encoding scheme and a bit about how the tool works.
Describes the 3 student tasks to get familiar with the tool:
1. Create a small image: Start by trying to recreate the 3x5 letter “A” depicted (shown above) using the pixelation
widget.
2. Correct an error: Oh no! An extra bit was inserted into an image during transmission! Track it down.
3. Make your own image of any size of anything you like.
The image file protocol we used contains “metadata”: the width and height.Metadata is “data about the data” that
might be required to encode or decode the bits.
For example, you couldn’t render the B&W image properly without somehow including the dimensions. Prompts:
(Optional) Prompt:
"Did you think about compression at all while doing this exercise? Can you think of a way that you might
represent an image of pixel data with fewer bits? What would have to change about the encoding
strategy?"
For an answer to this see the "Color by Numbers" Activity from CS Unplugged (csunplugged.org).
It uses something called "run-length encoding"
Assessment
Check students responses on: B&W Pixelation Widget - Activity Guide
Check to make sure that the bits they submitted actually produce the image as claimed.
Score the digital artifact as you see fit, with points for creativity and perceived effort.
The following questions can be found in the Activity Guide and also appear on Code Studio
Answers these questions can be found here:KEY B&W Pixelation Widget
Extended Learning
Check out the "Color by Numbers" from CS Unplugged (csunplugged.org) which uses a different clever encoding
scheme for B&W images.
Do the Extension: Magnify an Image (optional) - Activity Guide activity (double the size of an image on the
Pixelation Tool).
Have students research raster graphics in anticipation of the subsequent lesson.
Attempting to communicate with possible intelligent life beyond our solar system has been a dream for humans and the
goal of scientists for many years. Questions about messages to send, as well as how to send messages deep into space
to unknown recipients have been debated. In 1974, scientists sent the Arecibo message to the star cluster M13 some
25,000 light years away. Read about the message they sent using 1,679 binary digits
(https://en.m.wikipedia.org/wiki/Arecibo_message).
How would you change the content of the message? What would you delete and add? Why would your change be
significant in a communication to other intelligent beings?
Sketch the segment of the design you would alter. Remember, you must retain the original number of bits.
List the details in this article that you understand more deeply because of what you have learned in this class up to
this point.
Standards Alignment
CSTA K-12 Computer Science Standards (2011)
CL - Collaboration
CPP - Computing Practice & Programming
CT - Computational Thinking
2
Lesson 4: Encoding Color Images
Overview View on Code Studio
In this lesson students are asked to consider how color is represented Objectives
on a computer and to imagine how it might be encoded in binary.
Students will be able to:
Students then learn about how color is actually represented on a
computer - using the RGB color scheme - and create their own Use the Pixelation Tool to encode small color
images in an new version of the pixelation widget that allows you use images with varying bits-per-pixel settings.
more than 1 bit per pixel to represent color information. After grappling Explain the color encoding scheme for digital
with the prospect of possibly many bits just to represent a single pixel, images.
students are shown how using hexadecimal allows us to represent Use the Pixelation Tool to encode an image of
many bits with fewer characters. Students use a new version of the the student’s design.
pixelation tool to encode an image with color and create a personal Explain the benefits of using hexadecimal
favicon. numbers for representing long streams of bits.
Purpose Preparation
The main purpose here, similar to the B&W pixelation activity is for (Optional) Consider demonstrating the
students to get hands-on and "down and dirty" with bits. A major color pixelation widget instead of showing the
outcome will also be understanding the relationship between video.
hexadecimal (base-16) and binary (base-2), and how useful it is to use KEY Encoding Color Images
hex to represent groups of 4 bits. It's important to realize that using KEY Video Guide "A Little Bit About
hex is not a form of data compression, it's simply a different view into Pixels"
the bits. KEY Hexadecimal Numbers (optional)
The most common color representation scheme - RGB - typically uses Links
24 bits (3 bytes) with 8 bits each for Red, Green and Blue intensities.
And one of the most common ways you see these colors represented Heads Up! Please make a copy of any
is in hexadecimal. The pixelation widget, with its ability to choose how documents you plan to share with students.
many bits represent the color value for each pixel, can be a very
useful tool for showing the utility of hex representations for bits. For the Teacher
The process of rendering color on a computer screen by mixing red, Teaching Tips & Tricks Video -
green and blue light is an important concept of this lesson. The results Encoding Images - Video (download)
are not always intuitive, because mixing pigment and mixing colored For the Students
lights (like what’s on a computer screen) lead to different results.
A Little Bit about Pixels - Video
Another important objective of this lesson is to understand how (download)
(uncompressed) image file sizes can become quite large. For Worksheet - Video Guide for "A Little
example, even a relatively small image of 250x250 pixels is a total of Bit about Pixels" (optional) - Worksheet
62,500 pixels, each requiring up to three bytes (24 bits) or color Make a Copy
information, resulting in a total of 1.5 million bits to store one image! Encoding Color Images - Activity Guide
Thus, interesting connections to compression can be made here, but Make a Copy
note that lossy compression and image formats like .jpg are covered Hexadecimal Numbers (optional) -
in the next lesson. Activity Guide Make a Copy
Discuss:
Following the video, you might address any questions (or give students time to complete the video worksheet)
Image sharing services are a universal and powerful way of communicating all over the world.
Digital images are just data (lots of data) composed of layers of abstraction: pixels, RGB, binary.
The RGB color scheme is composed of red, green, and blue components that have a range of intensities from 0 to 255.
Screen resolution is the number of pixels and how they are arranged vertically and horizontally, and density is the
number of pixels per a given area.
Digital photo filters are not magic! Math is applied to RGB values to create new ones.
There are 3 tutorial videos that appear in Code Studio that guide students through using the widget.
This activity guides students through a few levels to get used to representing pixel data with more than one bit per pixel.
It works up to full 24-bit RGB color and will present hexadecimal as a convenient way to represent binary information for
humans to read.
Color Pixelation widget tutorial video - Part 1 - Video : How to use the pixelation widget to control color.
Task 1: Fill in the last two pixels with the missing colors
Step 2: 6-bit color
Color Pixelation widget tutorial video - Part 2 - Video : more bits per pixel for more colors
Task 2: Experiment with 6-bit color
Step 3: 12-bit color and Hex
Color Pixelation widget tutorial video - Part 3 - Video : Using hex to type bits more quickly
Task 3: Experiment with Hex
Personal Favicon
(From the activity guide)
Directions
Create a personal 16x16 favicon and encode it using the Pixelation Widget on the final level of this lesson in Code
Studio.
The
Content Corner
image
you RGB color model - Additive Light
make Computer screens emit light, so when you mix RGB
should colors, you are really mixing light together. This is
counterintuitive for many students who have grown up
mixing paints in school. When you mix paint it absorbs
light.
It is illustrative to look at how you make black and white
with paint vs. light:
To make black: with paint, mix a full spectrum of colors
represent your personality in some distinctive way. together; with light, turn off all the lights.
You will be using this favicon in future lessons and To make white: with paint, don’t use any paint
web sites that you make, so be creative and (assuming canvas is white); with light, turn on all lights
thoughtful. for a full spectrum of color.
After you have finished your favicon, share it with This can make mixing colors a little bizarre too:
others in the class by sending them the bits with the
With paint, mix full red and full blue to make Purple
Internet Simulator Widget!
With light, mix full red and full blue to make Pink
Requirements
The Pixelation Tool is in RGB mode, as long as the
The icon must be 16x16 pixels. number of bits per pixel is a multiple of 3 (3, 6, 9, 12, etc.)
This allows for the same number of bits to be allocated to
You must use the Pixelation Widget to encode the
each color channel. Other bits-per-pixel settings will set
bits of color information. the image to grayscale, with more bits allowing finer
The image must be encoded with at least 12 bits per control over the shade of gray.
pixel. Hexadecimal Numbers:
Things to think about When working through the Activity Guide for the color
version of the Pixelation Tool, students will be introduced
A simple design with a few basic colors is probably
to the concept of hexadecimal numbers, so-called because
the best solution. How could you use more colors? there are 16 unique symbols that can appear in each place
Plan ahead: Sketch your design before starting to value, 0-9, A, B, C, D, E, and F.
encode the bits. You might want to use a tool to help
MISCONCEPTION ALERT
you draw small images. Suggestions:
It is important to note that hexadecimal numbers
Favicon Maker: http://www.favicon.cc/
are used to aid humans in reading longer strings of
Make Pixel Art: bits, but they in no way change the underlying
http://makepixelart.com/free/ data being represented. Instead, they allow us to
read 4 bits at a time rather than 1, and so allow us
to more easily parse binary information.
Wrap-up Hexadecimal representation is NOT a form of
compression, since the underlying binary
representation is not changing at all. Rather it is a
Submit Favicon more convenient way of representing that binary
information when humans need to read and
You should ask students to submit a .png version of their interact with it.
favicon, blown up to a larger size. And ask them to send
You may wish to separately address this topic as a class.
you the bits that made up the image. Students can practice with the Hexadecimal Odometer
and can complete this Hexadecimal Numbers
Gallery Walk (optional) - Activity Guide if you deem more practice
necessary.
With the images you can make a class favicon “quilt”
by printing them out.
And you can copy/paste the bits into the pixelation tool to verify that image is correct.
Assessment
Questions:
How many bits (or bytes) are required to encode an image that is 25 pixels wide and 50 pixels tall, if you encode it with
24 bits per pixel?
To help students understand how quickly the bit size of images expands as the image is enlarged, start with smaller
numbers (5 X 10) and then incrementally increase the width and height to illustrate the concept.
Imagine that you have an image that is too dark or too bright. Describe how you would alter the RGB settings to brighten
or darken it. Give an example.
Extended Learning
If you had to send your favicon using the sending bits widget, it would probably take a long time. Could you compress
your image? How? Describe in broad strokes the kinds of things you could do.
Read Blown to Bits (www.bitsbook.com), Chapter 3 , Ghosts in the Machine, pp. 95-99 (Hiding Information in
Images), then answer the following questions:
Besides hiding information sent to others, what other uses can steganography have for everyday users? For example,
what uses would steganography have for an American businessman in China?
Standards Alignment
CSTA K-12 Computer Science Standards (2011)
CL - Collaboration
CPP - Computing Practice & Programming
CT - Computational Thinking
If you are interested in licensing Code.org materials for commercial purposes,contact us.
UNIT Ch. 1 1 2 3 4 5 6
2
Lesson 5: Lossy vs. Lossless Compression
Research
Lossless Compression: a data compression algorithm that allows the original data to be perfectly reconstructed from
the compressed data.
Lossy Compression: (or irreversible compression) a data compression method that uses inexact approximations,
discarding some data to represent the content. Most commonly seen in image formats like .jpg.
Prompt: Have students briefly discuss the prompt below with a neighbor.
When you use lossy compression you lose the ability to decompress your information and get back a perfect copy. Even
so, people use lossy compression all the time. Can you think of reasons or situations where someone would still use
lossy compression?
Discuss: Have pairs briefly discuss with one another. Circulate and listen to ideas as they're discussed. Then have a couple
groups share with the whole room.
Transition: We’ve been looking at image file formats. And we’ve also seen text compression. Both of those attempted to
render perfectly every piece of information.
Both the image file format and the text compression scheme we used werelossless. Lossy compression schemes usually
Discussion
take advantage of the fact that a human is supposed to
Goal
interpret the data at the other end, and human brains are Goal: This prompt serves two roles. It first should get
good at filling the gaps when information is missing. students a chance to practice using the vocabulary you
just introduced. Use their responses to judge whether
students understand the distinction between the two types
Activity (40 mins) of compression. If necessary review the two before
continuing to the main activity.
Secondly it prompts students to begin thinking critically
Group: Place students in pairs. Each group will only about the tradeoffs of the two compression types which
need a single computer. they will be doing for the remainder of the lesson.
Distribute: File Formats and Compression -
Activity Guide to each group.
Content Corner
Rapid Research - Compression Formats
Formats in Everyday Life: The file extension you often
JPG: Ask all groups to research the answers to the first see on a file (for example: myPhoto.jpg) is really just an
column in the activity guide together. In particular indicator to the computer of how the underlying bits are
remind them to keep track of their sources of organized, so the computer can interpret them. If you
information. change the name of the file to myPhoto.gif, that does not
magically change the underlying bits; all you’ve done is
Share: Have pairs share their answers with another confuse the computer. It won’t be able to open the file
pair. If there are disagreements have them discuss with because it will attempt to interpret the file as a GIF when
really the bits are in JPG format.
one another the sources of their information and try to
arrive at a shared solution.
Discuss: Share the solution to the first column as a class. Resolve any discrepancies. Afterwards briefly acknowledge the
following points.
JPG is lossy compression. Many images on the web are converted to JPG. Odds are if you've seen a grainy or
pixelated image on the Internet, it's a JPG.
Lossy compression like this results in a lower quality image with fewer details, but as humans we can still tell what's in
the picture. Especially in instances where you don't need a high quality image and bandwidth is limited JPG makes a
lot of sense.
This is a free and open format, but even so there have been disputes about its ownership.
Share: Once both columns have been filled out have pairs share their results across the table again.
Discuss: Share out the results of the research with the whole class, reviewing the results.
Wrap-up (5 mins) Teaching Tip
Standards Alignment
CSTA K-12 Computer Science Standards (2011)
CD - Computers & Communication Devices
CL - Collaboration
CT - Computational Thinking
If you are interested in licensing Code.org materials for commercial purposes,contact us.
UNIT Ch. 1 1 2 3 4 5 6
2
Lesson 6: Rapid Research - Format
Showdown
Project | Research
Remarks
Today we're going to dig a little deeper into this question by doing a Rapid Research project. Not only are you going to
research your own file format, you're going to make the case why yours is the best!
Day 1 - Choose Format, Differences from the actual Explore PT: The actual
Research, Begin One-Pager Explore Performance Task will be completed over 8 class
hours. The fact that this schedule is significantly shorter
Review Activity Guide and Rubric: reflects several differences in this Practice PT.
At the beginning of the project, emphasize the Students are not choosing a computing innovation by
importance of reviewing the one-pager template and the College Board's definition (file formats and protocols
rubric. Students may assume that more is required of do not process data, include program code, etc.)
them than is actually the case. Students are not completing most of the prompts of the
Explore PT
Choosing Your Format: It is recommended that you
Research in this project is presumed to be less detailed
place a time limit on this process (e.g. 10 minutes). You
may even consider simply assigning formats yourself.
They are all essentially equivalent in terms of difficulty. There's minimal difference in terms of "quality" so long as students
take a creative angle towards the presentation. All these formats have been used by someone at some point, so their job
is to find out why and creatively play up that angle.
Conduct Your Research: This document is intended to serve primarily as a guide to students for identifying online
sources of information. The skill students need to develop is identifying useful resources on their own and then
synthesizing this information. Being presented with a structured way of doing this means students will have a model for
how to complete their research when completing the actual Explore PT.
The "Key Information to Find" highlights specific terminology from the Explore PT that students will benefit from having
Teaching Tip
seen earlier in the course.
Reinforce Research Skills from the Previous
Begin One-Pager: Have students begin working on
Lesson: As students saw in the previous lesson,
filling in the details of their one-pager as they research. performing research on computing topics is a skill unto
itself. Reinforce skills reviewed in the previous lesson as
Day 2 - Complete One-pager students move to this part of the activity.
and Computational Artifact
Complete One-Pager: Students should continue filling in their one-pagers. Remind students to record their sources of
information as they go.
Computational Artifact: Decide if you will encourage students to all create separate kinds of computational artifacts or
if they will do them in a unified way. You might have everyone create a slide, a short video (e.g. a 30 second "campaign
ad" for their format) etc. Remind students of the requirements for this artifact (noted below):
A list of other formats you’d specifically like to target in your computational artifact
Three key points you’d like to make in your artifact explaining the benefits of your format
Standards Alignment
Computer Science Principles
1.1 - Creative development can be an essential process for creating computational artifacts.
1.2 - Computing enables people to use creative development processes to create computational artifacts for creative expression or to solve a
problem.
2.1 - A variety of abstractions built upon binary sequences can be used to represent all digital data.
2.2 - Multiple levels of abstraction are used to write programs or create other computational artifacts
3.2 - Computing facilitates exploration and the discovery of connections in information.
3.3 - There are trade offs when representing information as digital data.
7.3 - Computing has a global affect -- both beneficial and harmful -- on people and society.
7.5 - An investigative process is aided by effective organization and selection of resources. Appropriate technologies and tools facilitate the
accessing of information and enable the ability to evaluate the credibility of sources.
If you are interested in licensing Code.org materials for commercial purposes,contact us.