A computer stores text, pictures and sound all as numbers. The same numbers mean different things depending on how a program reads them: 72 is the letter H to a text program, a dark grey to a paint program and a sound level to a music program.
A message, a photo and a song all end up in the same computer memory. What is actually stored there?
Everything a computer stores, whether a message, a photo or a song, is stored as numbers. A number on its own does not say what it is. A program has to read it with a rule, called an encoding: a text program reads each number as a letter, a paint program as a colour, a music program as a sound level.
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
One file, two programs
TryTry it on the board and compare the result with your prediction.
Try: read the same numbers
Now try Sound and All three. The top row never changes.
Try it yourselfYour edits are saved in this browser.
The board reads 72, 105, 33 as text. Switch it to read them as grey shades. Did the numbers change?
Use the board. This ticks when you get there.
InvestigateWork out why it happens, one step at a time.
Worked example: one number, three meanings
Worked exampleBefore each step, say what you think comes next.
72The number stored. It is the same in every row.
72→HAs text: the letter whose code is 72.
72→dark greyAs a grey shade: 0 is black and 255 is white, so 72 is darkish.
72→below the middleAs sound: 128 is the middle (silence), so 72 is a level below it.
same number, different ruleThe encoding, not the number, decides what it means.
Now read 255 as a shade.
Sam reasons about a file holding 72, 105, 33. Click the line where the reasoning first goes wrong.
ModifyChange the problem on purpose and see what happens.
Vary: change one number
Try it yourselfYour edits are saved in this browser.
Make the first number 255. What happens in each row?
Use the board. This ticks when you get there.
Now make the first number 0.
Use the board. This ticks when you get there.
Make the first number 74. What letter is it? (H is 72.)
Use the board. This ticks when you get there.
Make all three numbers 128. What does the sound row show?
Use the board. This ticks when you get there.
Make the first number 10. What does the text row show?
Use the board. This ticks when you get there.
PractiseA few on your own, to check you have it.
Which rule?
In text, A is stored as 65 and the letters go in order. What number stores C?
MakeMake your own problem using what you have learned. Expect a few tries; that is normal.
Write a word
Then switch the reading: what does your word look like as grey shades, and as sound?
Try it yourselfYour edits are saved in this browser.
Need a hint?
Capital letters start at A = 65 and go in order. Lower case starts at a = 97.
Another hint
Y is the 25th letter, so its code is 65 + 24 = 89.
Another hint
e is 97 + 4 = 101 and s is 97 + 18 = 115.
Change the three numbers so the text reads Yes (capital Y, then lower case e and s).
Use the board. This ticks when you get there.
For teachers
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). About 35 minutes.
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.
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
A student says the file contains the word Hi! (Sam's mistake). Ask: What does the top row show? Is there an H in it? Fix: 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. Ask: What is A's code? How far along the alphabet is your letter? Fix: Count on from A = 65 (or a = 97 for lower case).
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.
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.
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.
Now you can
Say how text, pictures and sound are all stored.
Explain why the same number can mean different things.
Give an example of a number standing for something that is not a number.