Lesson 1 of 8 in the free SOLID Principles with Examples course on DevLadder.
"A class should have one, and only one, reason to change." — Robert C. Martin
"Reason to change" = one actor or stakeholder. A class that formats invoices and saves them and emails them changes when finance, DBAs or the email provider change.
Interview tip: SRP doesn't mean "one method per class". It means one cohesive job. Controllers that only orchestrate are fine.
Source: DEV - interview — Read the full article on the original site ↗
