Two copies of one book: which one do you reserve?
transcript
Two copies of Godan. Ishaan has one. Zoya has the other. Rohan wants it too. So what does he reserve?
The naive model: one book class, with an is borrowed flag. Two copies? Two book objects, same title, same author. Search shows duplicates. And reserve Godan points at nothing. So split it. A book is a title in the catalogue. A book copy is one object with a barcode and a status.
One title, Godan. Two copies, each with its own barcode. A loan points at a copy. Ishaan has G1. Zoya has G2. But Rohan's reservation points at the title. Whichever copy comes back first will do.
You take home a barcode. You're fined for a barcode. But you wait for a title. That asymmetry is the model.
One title, many copies. Two classes, not one flag on one class. Loans point at copies. Reservations point at titles.
Full breakdown in the lecture.