Beep Detective
You slide a candy bar across the scanner at the checkout. BEEP. The price appears on the screen. But here's the thing โ the barcode doesn't contain the price at all. It's a secret number, and the scanner is a detective.
Those black and white stripes on the wrapper are a code โ just a number, like 036000291452. That's the candy bar's ID number, its name tag in the store's computer system. The barcode is a way to write that number in a language scanners can read: stripes.
The scanner shoots a red laser beam across the stripes. Black bars absorb the light โ they swallow it up and nothing bounces back. White spaces reflect the light back to the scanner like a mirror. So as the laser sweeps across, it gets a pattern: dark, light, light, dark, light, dark, dark.
The scanner translates that pattern of reflected light back into the number. It's like reading Morse code with a flashlight. Each digit from 0 to 9 has its own stripe pattern โ a 5 looks different from a 7, a 3 looks different from a 9. The scanner decodes the flashes: "Aha! This is 036000291452."
Now comes the clever part. The scanner sends that ID number to the store's main computer โ the one connected to every checkout lane, humming away in a back room somewhere. The computer looks up the number in its giant database, a list of every product the store sells.
The database is like a phonebook. Your candy bar's number is the name, and next to it is all the information: "Chocolate Bar, aisle 4, 32 in stockโฆ and the price is $1.29." The computer finds the match in a fraction of a second.
The computer sends the price back to the checkout screen. BEEP โ $1.29 appears. The barcode never knew the price. It was just the question. The computer had the answer all along, waiting in its electronic phonebook for someone to ask.
So every time you hear that beep, you're watching a conversation: the scanner asks "Who is this?", the computer answers "That's a chocolate bar, and today it costs $1.29." The stripes are just the scanner's way of reading the question out loud.
