Lesson 1: SRP and responsible objects
Picture one InvoiceManager class that validates order lines, calculates the total, and emails the receipt. A designer asks for a tiny wording change in the receipt — and suddenly the total calculation breaks, because the math and the email format are tangled inside the same object. This lesson teach
SRP is like a restaurant kitchen where each station has one job: the salad person never touches the oven. Changing the soup can't ruin the dessert.
- Single Responsibility Principle (SRP)
- Every class has exactly one reason to change: one business or technical force whose requirements touch it.
- reason to change
- A force that dictates change in a class: pricing rules, email format, storage. Count forces — not methods.