Episode #314

Interface Segregation Principle

Series: S.O.L.I.D.

14 minutes
Published on December 7, 2017

This video is only available to subscribers. Get access to this video and 586 others.

In this episode we examine ISP (the Interface Segregation Principle). This one states that a type should not depend on methods from an interface that it will never use. Often times this means that the type probably carries too many responsibilities, but breaking it apart is difficult for other reasons (perhaps too many things depend on it and changing it would be expensive). You can extract smaller interfaces that support the individual responsibilities, but still have the same class adopt it. Doing so opens up opportunities for further refactoring and testing.

This episode uses Xcode 9.1.