499 or 49,900?
transcript
A customer pays 499 rupees. You call the vendor's SDK. Which number do you send? 499? Or 49,900? It depends on the vendor. And that's the trap.
Alpha counts in paise. So 499 rupees is 49,900 paise. Beta counts in rupees. So it's plain 499. Same payment, two numbers.
Say the checkout talks to both. Each branch converts by hand. Now forget one times 100. In one branch. Just one. Alpha receives 499. In paise. That's 4.99 rupees. The customer pays a hundredth.
The fix is one small class. The adapter. The checkout always says 499 rupees. It never learns paise. The adapter always says 49,900 paise. Only it knows. One place to slip. One place to test.
An adapter translates three things. First, names and shapes. Second, units. Paise to rupees, and back again. Third, errors. A vendor's code becomes your exception.
Translate units in one class. At the edge. Not in the checkout. Not in every branch.
Full breakdown in the lecture.