Srp | Main _top_

Let’s look at a common violation found in many legacy codebases: The Employee class.

The most common mistake developers make is equating SRP with functional cohesion. They think SRP means: "A class should do one thing." srp main

class HRSystem: def promote_employee(self, employee: EmployeeRecord): # Logic strictly for HR print(f"Promoting {employee.name}") Let’s look at a common violation found in

1. The Core Definition: Single Responsibility Principle (SRP) if the CFO changes the PayrollSystem

Now, if the CFO changes the PayrollSystem , the HRSystem is completely unaffected. The code is safer, easier to test, and easier to maintain.

Adhering to SRP provides tangible benefits that scale with your project: