A barcode is a tag composed of black and white sections which encodes data for a computer to read. A barcode itself is simply a pattern that can be printed; there is no hardware in it. A typical use for barcodes is to store information about products in a shop: a computer such as a handheld reader or a till at the checkout can read the barcode on the product's packaging and instantly retrieve some sort of identifier, allowing the computer to then connect to a local server and retrieve product information such as price, name, or active sales. Common varieties include UPC which are often used to mark products, and QR codes which are a 2-dimensional variety that are more regularly used for advertising.
A barcode reader is a device that reads barcodes, most often accomplished using a laser or an LED along with a photosensor. The major components of a barcode reader are the laser/LED, the photodiode and the Analogue to Digital Converter (ADC):
The laser (or LED) emits light onto the barcode at such an angle that it will reflect back into the scanner; this allows the amount of light present to be quantified and thus the brightness of that section of barcode to be determined.
The photodiode converts light energy into electricity. The strength (i.e the voltage) of the resulting electric current is determined by the amount of light energy absorbed, so the analogue electric signal can be used as a representation of the brightness of the incoming light.
The Analogue to Digital Converter (ADC) takes the analogue electrical signal from the photodiode and samples it, converting it into a digital value that can be stored by a computer.