Does the Single Responsibility Principle mean a class should only ever have one method?
No — that's a common misreading. SRP is about a class having one reason to change, not a fixed method count. A class can legitimately have many methods as long as all of them serve the same underlying responsibility; for example, an Invoice class with generateInvoice(), getAmount(), and getFormattedTotal() can still satisfy SRP because every one of those methods only changes when billing or display rules change. Conversely, a class with only two methods can violate SRP if those two methods represent unrelated concerns, such as one line of billing logic and one line of email-sending logic packed into a tiny class. Over-applying the "one method per class" misreading is itself a design mistake, since it creates unnecessary indirection without tracking any genuine, independent axis of change.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response