barcode
A barcode is a set of bars and gaps standing for a number a scanner reads back in one pass.
In more detail
The bars are the number, written so that a beam of light dragged across them can read it: wide and narrow, dark and light. There is nothing else in there — no name, no price. The number is a reference, and what it is worth is whatever the shop or the warehouse has recorded under it.
Most kinds end in a digit worked out from the ones before it. A scanner redoes that sum every time it reads a code and refuses the reading when it does not come out, which is what stops a smudge being taken for a different article.
There is not one barcode but a family of them, and which one is used is fixed by the trade rather than by whoever prints it. A shop till reads EAN-13, UPC-A, EAN-8 or UPC-E. A loose cut of meat or a piece of fruit carries a GS1 DataBar, which holds the same number in a symbol read from any angle. The case those goods travel in carries ITF-14. A workshop label, a store bin and a hospital wristband carry Code 39 or Code 93. A blood bag, a library card and a courier's airbill carry Codabar. Code 128 is the one that takes any text at all. Beside a magazine's code or a book's stands a small extra set of bars — the add-on — carrying the issue number or the price the publisher suggests.
What it does on a real document
Whether a code works is not a question the page can answer, and not one an eye can: only a scanner can. Before a change enters the library, every code these pages show is drawn, the finished page turned into an image, and read back by a decoder that never saw what drew it — and what it must read is taken from the request that asked for the code, so no list of expected answers can quietly drift out of step. The same page is compared with the library's own, pixel for pixel.
Two things break a code on a finished document, and both happen after anybody looked at it: a code fetched as a picture and then resized, which thickens the bars unevenly, and a white margin somebody trimmed off to make it fit. Drawn into the page line by line, at whatever size the document is printed, neither can happen.
Where it comes from, and why
The idea was patented in 1952, as a bullseye of rings rather than as bars, and waited twenty years for a light cheap enough to read it. The first one over a till was a packet of chewing gum in an American shop in 1974 — the packet is in a museum, and the arrangement it started is now on nearly everything sold anywhere.