Weekly Deals: Pass the Rule In

When this week's deal is picked by a switch inside checkout, every new deal means editing the code that handles the money; handing the deal into checkout as a function, the Strategy pattern in its simplest form, lets a new deal be written without touching checkout at all.

By

Updated

Cheat sheet: Weekly Deals: Pass the Rule In
Category
Data Structures
Level
Apprentice
Tags
Code Smell, Higher-Order Function, OOP, Strategy Pattern