The other day, I went grocery shopping. While waiting in line, I thought about some struggles I had in a test I wrote earlier that day.
When it was my turn, the cashier scanned my items and said what I owe him. And I just gave him my whole wallet. He stared at me blankly and gave it back. A little confused for a second, I took out my card, paid, and left the store. And at that point, it hit me what was wrong with my test.
Instead of giving the cashier our whole wallet, let’s just give them what they need. Not more, not less.
Sometimes, you need to make code more trivial to see the higher-level patterns that solve the issue at hand more elegantly.