Loading lesson…
Level 1 · Apprentice0 XP
Five principles, shown by fixing one class that does too much.
Step 1 / 5
ProblemReportService fetches data, formats PDF and CSV, emails the file and writes an audit log. Any change touches it, and every test needs a database and a mail server.
← → step
Before this: Coupling and cohesion
🛠️ 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 a class in your codebase with 'Manager', 'Service' or 'Util' in its name and more than 200 lines. List its reasons to change (who would ask for each change?). Extract the smallest one into its own class behind an interface.