One offer, 1,250 seats
transcript
Someone gives one seat a special offer. A hundred rupees. Then all 1,250 regular seats cost a hundred. How did one seat change all of them?
The regular seats share one kind object. And the price lives inside it. The offer sets the price, through one seat. But it really writes to the kind. So every seat sees a hundred. Nothing crashed. Nothing complained.
First, freeze the kind. Then the write can't even happen. Then keep the offer outside it, in a map keyed by row and number. A seat's price is its offer, or else the kind's.
Exactly one seat is at a hundred rupees. Just the one. And the kind still costs two hundred. Everyone else is untouched, as it should be.
The object is shared. So a write reaches everyone who shares it. Every single seat. Freeze it. And keep exceptions outside, with the seat.
Full breakdown in the lecture.