Single Responsibility Principle
The single responsibility principle in SOLID: give each class one reason to change, by splitting it along the people who ask for changes.
The single responsibility principle is the S in SOLID, and the one most often misread. It does not say a class should do one small thing. It says a class should answer to one group of people, so that a change requested by one group cannot break the work of another.
The topic starts with that definition and a class that breaks it, then refactors the class step by step, in Python, Java and TypeScript, until each reason to change has its own class. Two examples follow on very different surfaces: an employee class whose payroll change corrupts a report for HR, and Python's logging module, which is split the same way.
The last cards correct the opposite mistake, splitting until every class has one method, and give you a class to split yourself.
By the end you can count the reasons a class has to change, split it along them, and tell one responsibility from one method.
Contents
8 cardsnot started