Loading lesson…
Level 1 · Apprentice0 XP
One thing changes, many things react, and the source does not know who they are.
Step 1 / 5
ProblemWhen an order is placed, the Order class calls the email service, then analytics, then the warehouse, then loyalty points. Each new reaction means editing Order, and one failing call breaks them all.
← → step
Before this: Flyweight
🛠️ 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.Write an OrderService that notifies listeners when an order is placed. Add two listeners (print a receipt, count sales). Then add a third without touching OrderService, and make sure one listener throwing does not stop the others.