Students switch one set of numbers between text, grey shades and sound to see that all data is stored as numbers and that an encoding gives the numbers their meaning (AC9TDI8K03 node 1).
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
SlidesDownload Present from the browser, or export to PowerPoint or PDF.
WorksheetDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can say how text, pictures and sound are all stored.
I can explain why the same number can mean different things.
I can give an example of a number standing for something that is not a number.
Timing
Predict and Try 6 min · Worked example 10 min · Vary 9 min · Practise and Make 10 min
Before class
Try the board yourself first: switch between Text, Grey shades and Sound.
The one idea (the kit's hinge for AC9TDI8K03): every kind of data is stored as integers, and an encoding (the rule a program reads them with) gives them meaning. The next three lessons look at each encoding properly (text codes, RGB pixels, sound samples); then the binary lessons show how each number is stored.
Simplifications to say out loud if asked: text codes here are ASCII (A = 65); real text uses Unicode, which includes the same codes for these letters. Real pictures use three numbers per pixel (red, green, blue), not one grey. Real sound uses many thousands of samples a second.
Running the lesson
Predict: students who chose "the letters drawn as a picture" think the letters are stored. Ask what the computer actually has.
Try: ask whether the top row changed when they switched.
Worked example: before each line, ask what 72 will be under the next rule.
Vary: ask why 10 shows nothing as text but a fine shade as grey.
Make: have students check their word as shades and as sound.
The hard part (on purpose)
Students think the letters or colours are in the file and the numbers are a translation. Keep pointing at the top row: that is all the computer has; the rows below are what programs make of it.
When students get stuck
What you will see
A question to ask
The fix
A student says the file contains the word Hi! (Sam's mistake).
What does the top row show? Is there an H in it?
The file holds 72, 105, 33. Hi! is what a text program makes of them.
A student can't find a letter's code in Make.
What is A's code? How far along the alphabet is your letter?
Count on from A = 65 (or a = 97 for lower case).
Answers to the checks
one file, two programs: A file holds three numbers: 72, 105, 33. A text program opens it and shows **Hi!**. A paint program opens the same file. What does it show? Three shades of grey. The paint program reads each number as a shade (0 black, 255 white), so 72, 105 and 33 are three darkish greys. The letters only exist when a text program reads the numbers.
Try: read the same numbers: The board reads 72, 105, 33 as text. Switch it to read them as grey shades. Did the numbers change?
The numbers are still 72, 105, 33. Read as shades they are three greys, because the rule for reading them changed, not the data.
Read 72 three ways: A paint program reads numbers as grey shades from 0 (black) to 255 (white). What does it show for 255? White 255 is the top of the scale, so it is white. The same 255 in a text file would be read as a character instead.
Find the mistake: Sam reasons about a file holding 72, 105, 33. Click the line where the reasoning first goes wrong. line 3 Line 3: the numbers don't mean Hi! by themselves. Hi! is what a text program makes of them. A paint program reads the same numbers as greys, so line 5 is wrong because line 3 was.
A number for something else: Which of these is an example of a number standing for something that is not a number? 65 stored for the letter A in a text message In text, the letter A is stored as the number 65. The 65 is a code for a letter, not an amount.
White: Make the first number 255. What happens in each row?
As a shade, 255 is white. As sound, it is the loudest level above the middle. As text, it is not one of the basic letters.
Black: Now make the first number 0.
0 is black as a shade, the lowest level as sound, and a control code (not a letter) as text.
The next letters: Make the first number 74. What letter is it? (H is 72.)
Letters have codes in order: H is 72, I is 73, J is 74.
Silence: Make all three numbers 128. What does the sound row show?
128 is the middle line, so the sound is silent. As shades, 128 is mid grey.
Not a letter: Make the first number 10. What does the text row show?
10 is a fine shade and sound level, but as text it is a control code (a new line), not a letter you can see. Not every number means something useful under every rule.
Letter codes: In text, A is stored as 65 and the letters go in order. What number stores C? 67 A is 65, B is 66, C is 67.
Wrong program: A music program opens a text file. What will you most likely hear? Noise: it reads the letter codes as sound levels The music program reads every letter code as a sound level, so meaningful text becomes meaningless noise. The data is fine; the rule is wrong for it.
Shades: A grey shade of 0 is… Black 0 means no light, so black.
File types: Why does a file need to say what kind of data it holds (for example .txt or .png)? So the program knows which rule to read the numbers with The numbers alone don't say what they are. The file type tells programs which encoding to use.
write a word: Change the three numbers so the text reads Yes (capital Y, then lower case e and s).
Y is 89, e is 101, s is 115. A paint program would show the same numbers as three greys.
Solutions
One possible solution for each task. Other correct programs are fine.
Vary: change one number › White
Open task: any program that does what the step asks.
Vary: change one number › Black
Open task: any program that does what the step asks.
Vary: change one number › The next letters
Open task: any program that does what the step asks.
Vary: change one number › Silence
Open task: any program that does what the step asks.
Vary: change one number › Not a letter
Open task: any program that does what the step asks.
write a word
Open task: any program that does what the step asks.
Stretch and support
Stretch: Open any small image or text file in a hex viewer (or ask the teacher to show one). Can you find the letter codes in a text file?
Support: Give a short code table (A = 65 … Z = 90, a = 97 … z = 122) for Make.
Exit ticket
The number 66 is stored in memory. Give two different things it could mean.
Any two of: the letter B (as text), a dark grey (as a shade), a sound level below the middle (as audio), or the number 66 itself. Which one depends on the program's encoding.
What each step is for
one file, two programs: Committing to what a paint program shows for numbers a text program shows as Hi! tests the new move: the same numbers take a different meaning under a different encoding.
Try: read the same numbers: Switching the board from text to grey shades settles the prediction: the numbers stay 72, 105, 33 while what they show changes.
Worked example: one number, three meanings: Reading 72 with each rule in turn models the new move: the number is fixed and the encoding gives it its meaning. Sam treats the letters as part of the data, the misconception planted after the method.
Vary: change one number: Each task changes one number and watches all three readings at once: white, black, the next letters, silence, then a control code that is a valid shade but not a visible letter.
which rule?: Choosing the encoding from what a program shows, the next letter code, and a program reading data with the wrong rule.
write a word: Building a word from letter codes reverses the process: students start from the meaning and set the numbers that encode it.
Where it leads
Next: Text as numbers (character codes and Unicode).
Where it leads: images as RGB pixels and sound as samples (the rest of AC9TDI8K03), then binary: how each number is stored with only 0 and 1.