It had been calculated that only ten digits were needed; the barcode had to be readable from any direction and at speed; there must be fewer than one in 20,000 undetected errors.
Based largely on morse code, and originally intended to streamline the checkout process at a supermarket, the barcode has a pretty interesting history. Iterate, iterate, iterate; and eventually success ensues, as does widespread adoption of new and useful technologies.
Read more about it here, via the Smithsonian Magazine.