How would you answer an interview scenario involving Single Responsibility Principle?
For an interview scenario involving Single Responsibility Principle, I would first clarify the business goal, scale, constraints, and the failure or quality attribute the interviewer wants to explore. SRP says a module should have one cohesive reason to change rather than mixing unrelated responsibilities. In this scenario, a service validates orders, saves them, sends email, and writes audit logs. Explain how SRP guides refactoring. For production, group behavior around one business or technical responsibility and split components when change drivers are genuinely independent. I would then explain the main alternatives and tradeoffs, identify likely failure modes, and describe how I would validate the solution through testing, observability, security controls, and recovery or rollback planning.