Multiple ChoiceBeginner 45s
Strategy vs if/else
A shipping cost function branches on three carrier types. Which smell most directly justifies introducing a Strategy?
Options
- 1The function uses floating point arithmetic
- 2There are exactly three carriers, which is too many for one function
- 3Carrier-specific logic changes independently and is selected at runtime
- 4The function is called from more than one module
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.