Back

Activity 1.2: Data and What It Costs

divider

Data

And What It Costs

Key Concepts

Everything Is Bits

Making It Smaller

The Data About the Data

One Question

A photo, a song, and a sentence are all stored on the same drive, in the same way.

How can one thing hold all three?

A Switch

A computer can only really store one thing: off or on.

Write that as 0 or 1.

One of those is a bit.

Eight Switches

One bit gives you two options. Not many.

Two bits give you four.

Eight bits — a byte — give you 256.

Every extra bit doubles what you can say.

Text

Agree that 65 means A, 66 means B, and so on.

Now a number can be a letter. That agreement is called ASCII — a name worth knowing, and not one the exam asks for. The idea is what counts: the same bits mean different things by agreement.

Nothing in the machine knows it is a letter. We decided that.

Color

Three numbers: how much red, how much green, how much blue.

Each from 0 to 255. One byte each.

Three bytes per dot, and a screen has millions of dots.

That Adds Up

A 12-megapixel photo is 12 million dots.

Three bytes each is about 36 MB.

Your phone says that photo is 3 MB.

Where did the other 33 go?

Compression

Storing the same information in less space.

Lossless — you can rebuild the original exactly.

Lossy — you throw some away and cannot get it back.

Which One Where

A photo of a beach: lossy. Nobody notices.

A spreadsheet of grades: never lossy.

The question is always: is the thrown-away part one anyone needs?

The Data About the Data

That photo also stores when it was taken.

Which camera. Which settings.

Often where.

That is metadata, and you did not choose to include it.

Why It Matters

Metadata is small, easy to search, and travels with the file.

Which makes it useful — and makes it the part most worth being careful about.

Today's Objectives

  • Explaining how bits represent numbers, text, and color
  • Describing why more bits means more possible values
  • Choosing between lossy and lossless compression
  • Identifying metadata and what it reveals

Key Terms

Bit
A single 0 or 1. The smallest piece of data there is.
Byte
Eight bits, which can represent 256 different values.
Compression
Storing the same information in less space.
Lossless
Compression you can fully undo.
Lossy
Compression that permanently discards some data.
Metadata
Data about data — when, where, and how a file was made.

'F' → Fullscreen

divider

Build

No code today. These are the same tools a computer uses, with the lid off.

Task 1: Count to 255

Flip the switches. Watch the number change. Each switch is one bit.

0
0
0
0
0
0
0
0
= 0DEC
2726252423222120
1286432168421
  • Make the number 1. Now make it 2. Which switch moved?
  • What is the largest number you can make with all eight on?
  • Turn on only the leftmost switch. Then only the rightmost. Why is one worth so much more than the other?
  • Write down: if you had a ninth switch on the left, what would the new largest number be?

Task 2: Text Is Numbers

Type your name. Watch what the machine actually stores.

  • Type A, then B, then C. What is the pattern?
  • Type a and compare it to A. They are different numbers. Should they be?
  • Type a space. It has a number too. What is it?
  • Write down: how many bytes does your full name take, including the space?

Task 3: Color Is Three Numbers

Move the sliders. Every color on every screen is these three.

Hex: #000000

  • Make pure red, then pure white, then black. What are the three numbers each time?
  • Make a color you like. Write down its three numbers.
  • Write down: how many different colors are possible with three bytes? You worked out what one byte can do in Task 1.

Task 4: Throwing Some Away

This is the same picker with fewer bits per color. That is lossy compression, made visible.

00000000

  • Try to make the same color you chose in Task 3. How close can you get?
  • A photo saved this way is much smaller. Name something it would be fine for, and something it would ruin.
  • Write down: is this lossy or lossless? Say how you know.

Task 5: What Your Photos Know

No tool for this one. On your phone, open any photo and find its details or info.

  • List three pieces of metadata you find.
  • Is a location among them?
  • Write down: one situation where that metadata is genuinely useful, and one where you would want it removed before sharing.
divider

Checkpoint

You should be able to answer all five without looking anything up.

  1. How many different values can one byte represent?
  2. Adding one bit does what to the number of possible values?
  3. Give one example each of when lossy is fine and when it is not.
  4. Name two pieces of metadata a photo carries.
  5. A color needs three bytes. A 12-megapixel photo has 12 million dots. Roughly how large would it be with no compression at all?
divider

Reflection

Answer these before submitting your work.

  1. Nothing in a computer knows that 65 means A. People agreed on that. Name one other place where a number only means something because of an agreement.
  2. In two sessions you will have to say, before storing anything, whether a value is a number or text — and the program will refuse to run if you get it wrong. After today, why does the machine have to be told?
  3. Metadata is attached without you choosing it. Who benefits from that, and who might not?