Lesson 7: Sending Text

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 warm up students quickly create a system for representing the 50 states in binary. They then move to the main activity where they create a system for representing text using only numbers while communicating on the Internet Simulator. 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.

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 more easily reason about what those patterns mean.

Agenda

Activity (35 mins)

Wrap-up (10 mins)

Assessment

View on Code Studio

Objectives

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.

Preparation

  • Access to journals, paper, or other places that students can write down systems for the main activity.
  • Section prepped to use Internet Simulator in Code Studio.
  • Optionally print copies of ASCII Reference Sheet or prepare to project it

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the Teachers

For the Students

Vocabulary

  • 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.
  • ASCII - American Standard Code for Information Interchange; the universally recognized raw text format that any computer can understand
  • Protocol - A set of rules governing the exchange or transmission of data between devices.

Teaching Guide

Activity (35 mins)

Group: Place students in pairs.

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

Internet Simulator: Have students log into the Internet Simulator and pair with their partner. Once they're logged in you might encourage them to briefly use it to get familiar with the current set up.

Display: While students are getting familiar with the Internet Simulator, write a few example messages on the board. For example:

  • "hey"
  • "ttyl"
  • "morning"

Prompt: When we communicate on the Internet we're not usually sending numbers back and forth, we're sending text! The version of the Internet Simulator you're using only lets you send numbers, but 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 text message like the ones on the board. 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 the Internet Simulator.

Teaching 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.

Circulate: Give students a chance to discuss with their partner how they accomplish this task. This should be about 3 minutes during which they should write ideas on a sheet of paper. 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 the simulator. Once they're done have them check whether they successfully communicated it.

Challenge 2 - Punctuation and Capitals: 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.

Discussion Goal

Goal: 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's many possible systems and there's usually not a "right" one so long as everyone agrees.
  • You do briefly have to worry about bits if you have too many characters. For example, if you want 65 or more characters you'll now need at least 7 bits for each character.

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

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

Discuss: Have groups compare with each other. Then move to a full group discussion.

Introduce ASCII

Remarks

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 (pronoucned: “Ask-ee”) or the American Standard Code for Information Interchange

Distribute: Hand out copies of the ASCII Reference Sheet or project it where it can be seen. Quickly read the overview text at the beginning of the sheet.

Teaching Tip

How familiar with ASCII?: Students aren't required to memorize the ASCII table. Familiarity with its existence and the principles underlying it, as emphasized in this lesson, are all that's important. If your students are able to quickly recognize the point of the ASCII table feel free to move on to the points in the wrap up.

Prompt: Compare ASCII to the system you developed.

  • What's the same as the systems you created?
  • What's 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 (10 mins)

Discussion Goal

Goal: 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.

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 is it OK to "forget the bits"?
  • When or why did we need to remember that information is represented in bits?

Discuss: Students should quietly write an answer, then share with a partner, then discuss with the whole class.

Remarks

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.

Assessment

Teaching Tip

Some questions in this exam may seem just beyond the reach of students at this point in the year. That is intentional as it is a good simulation of the kinds of questions students might find on the real exam.

However as always these resources are just a suggestion and you should use them as best suits your class and their needs. The goal of CSP is to grow participation in computer science, so if offering this as a high stakes test early in the year will go against that goal maybe try going through the assessment in a lower stakes way (allow students to work with a partner, make the assessment worth less points, etc.) to practice for the future.

Lesson Assessment

Code Studio: Assessment questions are available on the Code Studio.

Chapter Assessment

There is a multiple choice assessment for this chapter available following this lesson. It can be found on the lesson right after this lesson and uses the Lockable Stages feature. If you are new to Lockable Stages check out How to Administer a Locked Assessment.

View on Code Studio

Sending Text

Directions: Design an encoding system to send text using the Internet Simulator. Your teacher will provide you with a number of increasingly complex challenges that you'll need to solve.

View on Code Studio

Student Instructions

View on Code Studio

Teaching Tip

47 character + another 47 with shift = 94 total characters. You'd need 7 bits to encode that many characters.

Student Instructions

View on Code Studio

Teaching Tip

Answer

The answer is 24 because the ASCII text "150" is just 3 ASCII characters - same as any other 3-character text, "ABC", "DOG", whatever. And in ASCII every character is encoded as one byte which is 8 bits, and 8 * 3 = 24.

Student Instructions

How many 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?'

View on Code Studio

Student Instructions

"The binary pattern 01000001 represents the number 65."

Write a brief response explaining whether you believe this statement is always true. Explain your reasoning.

View on Code Studio

Student Instructions

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

View full course alignment

CSTA K-12 Computer Science Standards (2011)

CL - Collaboration
  • CL.L2:3 - Collaborate with peers, experts and others using collaborative practices such as pair programming, working in project teams and participating in-group active learning activities.
CT - Computational Thinking
  • CT.L2:14 - Examine connections between elements of mathematics and computer science including binary numbers, logic, sets and functions.
  • CT.L2:7 - Represent data in a variety of ways including text, sounds, pictures and numbers.
  • CT.L3A:6 - Analyze the representation and trade-offs among various forms of digital information.

Computer Science Principles

2.1 - A variety of abstractions built upon binary sequences can be used to represent all digital data.
2.1.1 - Describe the variety of abstractions used to represent data. [P3]
  • 2.1.1A - Digital data is represented by abstractions at different levels.
  • 2.1.1B - At the lowest level, all digital data are represented by bits.
  • 2.1.1C - At a higher level, bits are grouped to represent abstractions, including but not limited to numbers, characters, and color.
  • 2.1.1D - Number bases, including binary, decimal, and hexadecimal, are used to represent and investigate digital data.
  • 2.1.1E - At one of the lowest levels of abstraction, digital data is represented in binary (base 2) using only combinations of the digits zero and one.
2.1.2 - Explain how binary sequences are used to represent digital data. [P5]
  • 2.1.2B - In many programming languages, the fixed number of bits used to represent characters or integers limits the range of integer values and mathematical operations; this limitation can result in overflow or other errors.
  • 2.1.2D - The interpretation of a binary sequence depends on how it is used.
  • 2.1.2E - A sequence of bits may represent instructions or data.
  • 2.1.2F - A sequence of bits may represent different types of data in different contexts.
2.2 - Multiple levels of abstraction are used to write programs or create other computational artifacts
2.2.1 - Develop an abstraction when writing a program or creating other computational artifacts. [P2]
  • 2.2.1A - The process of developing an abstraction involves removing detail and generalizing functionality.
  • 2.2.1B - An abstraction extracts common features from specific examples in order to generalize concepts.

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 3A-AP-21 - Evaluate and refine computational artifacts to make them more usable and accessible.
DA - Data & Analysis
  • 2-DA-07 - Represent data using multiple encoding schemes.
  • 3A-DA-09 - Translate between different bit representations of real-world phenomena, such as characters, numbers, and images.