Loading lesson…
Level 1 · Apprentice0 XP
Let objects do the work with their own data instead of pulling the data out.
Step 1 / 5
Problemif (account.getBalance() - amount >= 0 && !account.isFrozen()) account.setBalance(account.getBalance() - amount). This rule is copied in four services. One copy forgets the frozen check.
← → step
Before this: Null, edges and third-party code
🛠️ 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.Find code that does getX(), decides, then calls setX() on the same object. Move that decision into a method on the object. Then find one chain of three or more dots and hide it behind a method.