## Overview

In this lesson, students create their own system for representing text in binary and explore how their newfound ability to convert between binary and decimal numbers helps in this process. In the activity students will create a system for representing text using only numbers. At the end of the main activity they briefly review the ASCII system. The wrap up discussion introduces the concept of abstraction and its connection to the chapter. Following this lesson there is a chapter assessment that reviews the contents of this and the previous lessons.

## Vocabulary

**ASCII:**American Standard Code of Information Interchange; the universally recognized raw text format that any computer can understand.**Abstraction:**a simplified representation of something more complex. Abstractions allow you to hide details to help you manage complexity, focus on relevant concepts, and reason about problems at a higher level.**Protocol:**A set of rules governing the exchange of transmission of data between devices

## Goals

Students will be able to:

- Determine the number of bits per symbol needed for a representation system based on the total number of symbols it is necessary to represent.
- Use the decimal number system when designing ways to represent other information in binary.
- Explain how bits are grouped to represent abstractions like numbers and text.

## Purpose

This lesson concludes students' initial study of data representation. After this lesson students will understand the ways the most common types of information, text and numbers, are stored using binary. More importantly they should understand the challenges or principles that led to the creation of these systems. For example, in the previous lesson they saw that representing more numbers means you need more bits for each number. In this lesson they will see that needing to represent more symbols (in this case characters), similarly necessitates using more bits. They should also see the importance of shared protocols for communicating successfully with bits. The only reason a pattern of bits represents the letter "A" for example, is that everyone agreed to that system. Students should develop the important understanding that representation systems are somewhat arbitrarily created to solve a shared problem, and they work not because there was "one right answer" but because many people agreed to use them.

The wrap up discussion begins to explore the concept of abstraction. This is a challenging concept to understand and one that students will return to many times throughout the course. In this case their understanding only need be that, while we know everything on a computer is represented with patterns of binary electric symbols, we create abstractions (in this case decimal numbers) to allow us to more easily reason about what those patterns mean.

## Resources

## Activity

Place students in pairs. Give each pair lined sheets of paper, have them open a blank page of a physical journal, or find other resources that they can use to write down notes for a shared protocol.

**Prompt: **When we communicate on the Internet we're not
usually sending numbers back and forth, we're sending text! Although we will only be
using numbers in our communication, that doesn't mean we can't figure out our own way
to send text.

We'll be doing a series of challenges. Before each one I will give you a chance to talk to your partner. Then I'll give one member of each group a short message like "hey" or "ttyl". Your job will be to create an encoding system that will allow you to send that message. As always this will need to be done silently, with no communication except through your shared piece of paper.

**Discuss: **Give students a chance to discuss with their partner how
they will accomplish this task. Afterwards bring the group back together to run the 4 challenges
below.

**Challenge 1 - Spaces: **Silently give one member of each group the message "oh no"
(or another short message that uses a space). Tell them to silently start communicating using only their
shared piece of paper. Once they're done have them check whether they successfully communicated it.

**Challenge 2 - Capitals and Punctuation: **Silently give one member of each group the message "Great!"
or something similar that uses capitals and punctuation.

**Challenge 3 - Numbers: **Silently give one member of each group the message "Free at 5?"
or something similar that uses capitals, spaces, punctuation, and numbers.

**Challenge 4 - Review: **Silently give one member of each group the message "Cya 2nite!"
or something similar that uses capitals, spaces, punctuation, and numbers. This shouldn't introduce new
types of characters and is a chance for all groups to succeed.

#### Teacher Tip:

**Increasing the Challenge: **Each challenge here adds a slight layer of challenge.
The first introduces the need for spaces and capitals. The second introduces the need for punctuation
marks. The third introduces the need for number characters. The last is a review, and a chance for all
groups to succeed.**Send What You Can!: **Because of the design of these challenges, many groups probably
won't be able to send the full message for challenges 1 - 3. Encourage groups to send as much of it as
they can given the system they worked out. Encourage them that the whole point is to keep making it better
as they go. **Mapping Numbers to Characters: **The primary goal here is to have students get in the habit
of mapping numbers to other important information, in this case characters. The actual systems they develop
are less important and may not even need to be collected for assessment.

**Prompt: **Find another group. Discuss with them the following:

- Compare your systems. How are they the same? How are they different?
- What's the minimum number of bits each of your systems would need per character? How do you know?

**Discuss: **Have groups compare with each other. Then move to a full group discussion.
Aim to remind students of the insights in the warm up.

- Don't worry about the bits. It's much easier to just assign characters to numbers.
- There are many possible systems and there's usually not a "right" one so long as everyone agrees.
- You need to consider the number of bits if you have a lot of characters. For example, if you want 65 or more characters you'll now need at least 7 bits for each character.

__Introduce ASCII__

You just invented your own scheme for encoding text with numbers. Given
we use text on our phones and computers all the time, we should assume there is a standard
encoding for most of the symbols you can type on an American keyboard. Today we're going to be
looking at one called or ASCII (pronounced: "Ask-ee") or the **American Standard
Code for Information Interchange**.

Distribute the ASCII reference sheet and quickly read the overview text at the beginning of the sheet.

Compare ASCII to the system that you developed. Ask yourself:

- What is the same as the system that you created?
- What is different?
- What is most interesting or surprising about this system?

**Discuss: ** Briefly discuss these prompts as a class.
At this point the main features of the system should be familiar but use this
discussion to reinforce previous points.

## Wrap Up

**Prompt: **An interesting point of this lesson is that
sometimes when representing information on a computer we can "forget the bits" even though we know that's how all information is being represented.

- When in today's lesson was it OK to "forget the bits"?
- When or why did we need to remember that information is represented in bits?

**Discuss: **Have students quietly come up with an answer, share
with a partner, and then discuss with the whole class.

In computer science we deal with multi-layered systems so we need to
create easier ways for humans to keep it all straight in our heads. To do this we create an
*abstraction*, a simpler way of representing something complex. This lets us temporarily ignore
underlying complexity.

For example, we know that computers can represent text since we see it every day. Under the hood each character is really just a number, which itself is really a binary number, which itself is really just a bunch of electric impulses in a wire. We saw this over the last few lessons, but we don't need to remember it all the time. We can just do what we did today and say "A is 65", and worry about the details only when we need to.

Use the following goals to wrap up this discussion and chapter:

- Binary and decimal numbers can be converted back and forth.
- It's usually easier to think of representing other things, like characters, as decimal numbers first. We ignore the underlying detail that the decimal number needs to be converted to bits (binary) to actually send on a computer.
- We usually only think about the underlying binary representation when we have to. For example if we have a 6-bit system we know we only can represent 64 unique patterns. If we need more characters we'll need more bits.
- Something that allows us to hide or forget underlying details is
called an
*abstraction*. Today we were sending text to each other but we know under the hood that means we're just sending electrical symbols back and forth. All the different layers we've explored in this chapter (binary numbers, decimal numbers, letters) allow us to ignore or hide the complexity of sending electric symbols. This makes it easy to quickly create systems like you did today and feel confident the underlying system will work.

## Assessment

- What is the minimum number of bits you need to encode the 26 letters of the alphabet plus a space?
- 2 bits
- 3 bits
- 4 bits
- 5 bits
- 6 bits

- The standard QWERTY keyboard has 47 keys that can place characters on the screen.
Each of these keys can also display a second character by holding the "Shift" key
at the same time. How many bits would you need to encode everything that could be typed on this keyboard?
- 3 bits
- 4 bits
- 5 bits
- 6 bits
- 7 bits
- 12 bits

- ASCII has an encoding for every character of the alphabet as well as encodings for
numbers -- that is, encodings for the symbols of the digits 0-9. So here is a trick question: How many
bits are required to store the text of the number "150" in ASCII?
- 3 bits
- 8 bits
- 16 bits
- 24 bits
- 32 bits

- The binary pattern "01000001" represents the number "65." Write a brief response explaining whether you believe this statement is always true. Explain your reasoning.
- An abstraction is a simplified representation of something that is more complex.
Decimal numbers were a useful abstraction in the context of today's lesson. Write a short
response to both questions below.
- What is the underlying complexity decimal numbers were used to represent?
- How were decimal numbers helpful in designing a system to represent text in bits?

## Standards Alignment

**CSTA K-12 Computer Science Standards:**CL.L2:3**CSTA K-12 Computer Science Standards:**CT.L2:14, CT.L2:7, CT.L3A:6**Computer Science Principles:**2.1.1 (A, B, C, D, E)**Computer Science Principles:**2.1.2 (B, D, E, F)**Computer Science Principles:**2.2.1 (A, B)