An Employee class that calculates salary, saves data to a database, and generates reports. If the accounting department changes how salaries are calculated, you shouldn't have to risk breaking the database logic.
The Single Responsibility Principle is not about creating tiny, useless classes. It is about organizing your code so that it changes at the same rate and for the same reasons. srp main
# Responsibility 2: Accounting Logic def calculate_pay(self): return self.hourly_rate * 40 An Employee class that calculates salary, saves data
class ReportGenerator: def generate_employee_report(self, employee: EmployeeRecord): # Logic strictly for Reporting print(f"Report: {employee.name}") An Employee class that calculates salary
"Isolator needs manual approval from three principles: SRP, OCP, LSP."