0

I understand more or less the difference between them, with SRP telling that a class should only have one responsability, while ISP is more kind of looking from the client of a class point of view, where you don't want to get offered more methods than you need.

With this in mind, is there actually a way to break one principle without breaking the other?

  • Yes, it is possible. For example, a class can perform logging internally. Logging is another responsibility, different from the main class responsibility. At the same time, the class interface may not have any members that directly indicate the presence of logging. ISP is respected, SRP is violated. IMHO. – Alexander Petrov Mar 09 '23 at 19:22
  • Does this answer your question? [In SOLID, what is the distinction between SRP and ISP? (Single Responsibility Principle and Interface Segregation Principle)](https://stackoverflow.com/questions/14388358/in-solid-what-is-the-distinction-between-srp-and-isp-single-responsibility-pr) – jaco0646 Mar 09 '23 at 22:18
  • In particular see Robert Martin's [tweet](https://stackoverflow.com/a/55073007/1371329). – jaco0646 Mar 09 '23 at 22:19

0 Answers0