Two pizzas vanished
transcript
Ten pizzas in stock. Someone orders two. Eight left. Easy so far. Then a card is declined. And the stock drops to six. Where did two pizzas go?
Asha orders two. Eight left. Her card works. Ravi's card is declined in the app. The app gives the two back. Still eight. Ravi tries on the website. Declined again. But now it's six.
Two checkouts, the same four calls. Both reserve two pizzas, and both get declined by payments. The app's copy then calls inventory: release two. Stock is back to eight. The website's copy has no release arrow. Nothing crashed. Nothing even logged. The two pizzas just stay reserved.
The fix is a facade. One class, one method: place order. It reserves, charges, and books. If a step fails, it undoes the earlier ones, in reverse order. No caller can forget a step it never writes.
The sequence belongs in one class. So does the undo. Callers say what. One class says how.
Full breakdown in the lecture.