Loading lesson…
Level 1 · Apprentice0 XP
Add logging, caching or retries around an object by wrapping it.
Step 1 / 5
ProblemYou need a repository with logging, one with caching, and one with both. With inheritance that is three classes now and eight when you add retries and metrics.
← → step
Before this: Bridge
🛠️ 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.Given interface PriceService { fun price(sku: String): Double }, write a TimingPriceService decorator that prints how long each call took, and a CachingPriceService. Stack them both ways and explain what each order logs.