Interview practice question
Business logic inside controllers
Backend Engineering · OOP and Design Patterns · Intermediate
Your REST controllers contain database queries, business rules and email sending, making them long and untestable. How would you restructure?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Thin controllers: HTTP only.
- Move use cases to service/application layer.
- Domain rules into domain objects.
- Data access via repositories.
- Unit test services without HTTP.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.