Multiple ChoiceIntermediate 45s
OCP with real trade-offs
A discount engine grows a growing chain of if/else per customer tier. Which refactor best honors Open/Closed without over-abstraction?
Options
- 1Introduce a Strategy interface per tier and inject the right implementation
- 2Refactor to a single expression using a lookup map of functions per tier
- 3Add a plugin registry loading untyped callbacks from a database table
- 4Precompute every discount in a giant enum switch statement
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.