When a new member joins a library, a membership card is issued which has a barcode printed on it. Every book in the library also has a barcode printed inside it.
When a member takes a book out on loan, the barcode of the book is read by a barcode reader. So too is the barcode on the member's card. Together with the date, this makes up a transaction.
Input: book's and member's barcode, date, librarian's name, etc.
This transaction is then stored in the library's database.
N.B. Barcodes contain a check digit which is used for automatic validation by the barcode reader.