Loading lesson…
Level 1 · Apprentice0 XP
Many classic patterns become a function, a lambda or a higher-order function.
Step 1 / 5
ProblemA codebase has DiscountStrategy, FlatDiscount, PercentDiscount, NoDiscount: four files for what is really one function each.
← → step
Before this: Visitor
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Replace a Strategy class hierarchy with function types, and write three decorators (logged, timed, retried) that wrap a handler. Compose them and test each in isolation.