Tag: srp

Latest Posts
Single Responsibility Principle: One Class, One Job

A new security requirement arrives: passwords must be hashed with bcrypt instead of MD5. Simple enough. You open the User class to make the change and find yourself scrolling past email-sending logic, database queries, and input validation before you even get to the hashing method. You make the change, run the tests, and three unrelated things break.
This is what happens when a class has too many reasons to change. The Single Responsibility Principle exists to prevent exactly this: one class, one job, one reason to be touched.