oopdesign-patternssolid-principlesinterface-segregation-principle

Interface Segregation Principle- Program to an interface


I was reading about SOLID and other design principles. I thought ISP was the same as "Program to an interface, not an implementation". But it looks like these are different principles?

Is there a difference?


Solution

  • ISP is focused on the idea of each interface representing one discrete and cohesive behavior.

    That is, each logical group of things an object should do would map to a single specific interface. A class might want to do several things, but each thing would map to a specific interface representing that behavior. The idea is each interface is very focused.