Interview practice question
OrderService calls every module directly
Backend Engineering · OOP and Design Patterns · Beginner
After placing an order, OrderService directly calls email, analytics, loyalty and inventory classes, and every new feature means editing it. How would you decouple it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Observer / domain events.
- Publish OrderPlaced event.
- Listeners subscribe independently.
- OrderService unaware of listeners.
- Consider async/outbox for reliability.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.