Swap two checks and a customer hears something different
transcript
Three checks guard every payment. Limit, fraud, then the bank. What if you swap the first two?
Five payments, limit check first. The fraud check runs 3 times. Two payments are over the limit. They are declined there. So they never reach the fraud check at all. Swap them. Now the fraud check runs 5 times.
Tara pays 25,000 from a new account. It fails two checks. Limit first, she is declined. Fraud first, she is held. The order picked the answer. A customer hears something different. Nothing crashed, and no test failed.
Put cheap, decisive checks first. They shield the slow ones. A fraud check may call a service over the network. Say why in a comment, so nobody tidies it. And keep one test where two checks would both stop it.
Moving two checks isn't a refactor. The order is behaviour. Decide it on purpose.
Full breakdown in the lecture.