Theory
The beep at the kirana counter
Buying a biscuit packet next door to Chirag's shop, you watch the shopkeeper wave it past a glowing red window. Beep: name and price appear on the bill.
Now the puzzle: last month the same biscuits cost ₹10, today ₹12, and nobody re-printed anything on the packet.
So what exactly did the beep read, and where did the new price come from? The answer reorganises how you see every supermarket on earth.
Theory
A roll number in stripes
A barcode is just a number wearing a striped shirt. Thick and thin black bars against white gaps spell out digits the way dots and dashes spell Morse code. The stripes exist only because light can read widths faster and more reliably than printed digits. The number underneath is usually printed below the stripes, that is literally the same value, human-readable.
Theory
How the reader works
The reader is the scanner's reflection trick, specialised:
- it shines laser or LED light across the stripes;
- white gaps reflect strongly, black bars absorb;
- a sensor times the on-off reflection pattern and the bar widths;
- decoding turns that pattern back into the digits.
Then the crucial second half: the number goes to the billing system's database, which returns the item's name, price and stock entry. The beep confirms a clean read.
Theory
The insight that answers the puzzle
The barcode stores only an ID. The price lives in the database.
That is why the biscuit price changed without touching the packet: the shop edited ONE database row, and every packet on the shelf "changed price" instantly.
Same design as FASTag last lesson (tag holds ID, account lives in the backend). You are watching one of computing's deepest habits: identity on the object, meaning in the database, the exact idea your BCA105 database subject builds on.
Quiz
What is actually encoded inside a product's barcode stripes?
- Only an identifying number
- The product's name and current price
- The expiry date and batch details
- A small photo of the product
Show the answer
Only an identifying number
Stripes encode an identifier, nothing else. Name, price, batch, stock, everything meaningful, sits in the database that the ID unlocks. "The barcode contains the price" is THE classic misconception here, and the previous block's ₹10-to-₹12 story is your proof it cannot be true.
Think first
The barcode's square cousin
The QR code you scan for UPI payments is a barcode evolved into a square. What can it do that stripe barcodes cannot? Think about dimensions.
Show the answer
Stripes encode data in one dimension (widths along a line): enough for a short ID. A QR code packs data in two dimensions (a dot grid): hundreds of characters, enough for a full UPI payment address, a URL, or WiFi credentials. Bonus: your phone camera reads it, no laser needed, which is why QR conquered payments while stripes still rule store shelves.
Watch out
Where marks leak
Writing that the barcode stores price or product details: it stores an ID; the database supplies the rest, remember the price-change story. Misfiling the reader as an output device: it inputs data. And in barcode vs QR comparisons, the marks are for 1D vs 2D and laser reader vs camera, name both.
Theory
Watch the pattern compound
Three lessons in a row now share one skeleton: scanner (light reads paper), barcode (light reads stripes), RFID (radio reads tags), each capturing an identity that a database turns into meaning. When BCA105 introduces you to databases formally, remember you already met their purpose at a toll plaza and a kirana counter.
Summary
Key takeaways
- Barcodes encode a number as black/white stripe widths; readers decode reflections.
- Black absorbs light, white reflects; the pattern's timing spells the digits.
- The code holds ONLY an ID; price and details come from a database lookup.
- One database edit re-prices every packet instantly, no relabelling.
- QR codes are 2D barcodes: more data, camera-readable, power UPI.
- Memory hook: identity on the object, meaning in the database.