In SOLID, what is the distinction between SRP and ISP? (Single Responsibility Principle and Interface Segregation Principle)

SRP tells us that you should only have a single responsibility in a module. ISP tells us that you should not be forced to be confronted with more than you actually need. If you want to use a print() method from interface I, you shouldn’t have to instantiate a SwimmingPool or a DriveThru class for … Read more

Are there any rules for OOP?

Seems like what you’re looking for are the Principles of Object-Oriented Design. Summarized from Agile Software Development Principles, Patterns, and Practices. These principles are the hard-won product of decades of experience in software engineering. They are not the product of a single mind, but they represent the integration and writings of a large number of … Read more

What is an example of the Single Responsibility Principle? [closed]

The most effective way to break applications is to create GOD classes. Those are classes that keep track of a lot of information and have several responsibilities. One code change will most likely affect other parts of the class and therefore indirectly all other classes that use it. That in turn leads to an even … Read more

Interface Segregation Principle- Program to an interface

Robert Martin has a very good explanation of Interface segregation principle (ISP), in his book “UML for Java Programmers”. Based on that, I don’t think ISP is about an interface being “focused” on one logical, coherent group of things. Because, that goes without saying; or, at least it should go without saying. Each class, interface … Read more

Learning Single Responsibility Principle with C#

Let’s start with what does Single Responsibility Principle (SRP) actually mean: A class should have only one reason to change. This effectively means every object (class) should have a single responsibility, if a class has more than one responsibility these responsibilities become coupled and cannot be executed independently, i.e. changes in one can affect or … Read more