Which of the following class designs violates the Single Responsibility Principle (SRP)?
SRP means a class should have only one reason to change.
Option D mixes two responsibilities: authentication and email notifications, violating SRP. Other options have a single responsibility.
You have a class that manages both user data validation and user data storage. How should you refactor it to follow SRP?
Think about separating concerns into distinct classes.
Splitting responsibilities into separate classes ensures each class has one reason to change, following SRP.
What is a likely consequence of violating SRP in a large-scale system?
Consider how tightly coupled responsibilities affect maintenance.
Violating SRP causes classes to have multiple reasons to change, increasing risk of bugs when modifying one feature.
What is a potential downside of strictly applying SRP by creating many small classes?
Think about the overhead of many small parts in a system.
While SRP improves modularity, too many small classes can increase complexity in understanding and managing the system.
A microservice handles user profile updates, notification sending, and analytics tracking. Which change best aligns it with SRP?
SRP applies to services as well as classes.
Splitting the microservice by responsibility reduces coupling and aligns with SRP at the service level.