Thirty-three lines for one percentage
transcript
Tax is 5 percent. Finance says it might change by state one day. So you write a strategy, a factory, and a provider.
It's 33 lines of code. Four types. To replace one line. It prints 17 either way.
The factory has an if on a kind with one value. A number in settings does the job. A test sets it to 10.
A new teammate opens the tax code. They find a strategy, then a factory, then a provider. Three files, just to learn that tax is 5 percent. That's a reader paying for nothing.
Here's the test. Imagine a new requirement at minute seventy five. Would it make you edit the code that does the job? If not, don't add the pattern.
A strategy needs a second shape of rule, like a slab table. And it needs to be in the requirements, not in your head.
Full breakdown in the lecture.