Loading lesson…
Level 1 · Apprentice0 XP
The classic controller, service, repository stack: useful, and where it breaks.
Step 1 / 5
ProblemThe controller reads the request, checks rules, writes SQL and builds the response. It is 600 lines. Testing a discount rule means starting a web server.
← → step
Before this: SOLID in one example
🛠️ 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.Take one controller that contains business rules or SQL. Move the rule into a service (or use case) and the SQL into a repository whose interface is owned by the business layer.