The Owner's Wish List
Three change requests from the owner: a new deal every week, a screen in the kitchen, and one button for checkout.
Updated
A New Deal Every Week
- Weekly Deals: Pass the Rule In (Apprentice): 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.
Tell the Kitchen
- Observer: Tell Whoever's Listening (Apprentice): When the code that places an order has to call the kitchen screen, the customer's text and next month the delivery app by name, it grows with every new listener; the Observer pattern lets the order keep a list of whoever wants to know, and tell each of them, without knowing who they are.
One Button to Check Out
- Facade: One Button, Many Parts (Apprentice): When every screen that takes an order has to run payment, stock, the receipt and the kitchen itself, in the right order, the steps get copied and one copy forgets a step; a facade puts one simple front on those parts, so every caller makes one call.
Exercise: The Bakery's Wish List
- Exercise: The Bakery's Wish List (Journeyman): Take the owner's next ticket: the marketing team writes its own weekly deals and a delivery app wants to hear about every order. Change the working checkout and order desk so both plug in from outside, with the tests green throughout.