Substitution • Imagine you already have a class Circle, and you are asked to create a class Cylinder. • Or maybe you have a class Rectangle, and you are asked to create a class Square (a square is a rectangle with the same width and height). • Or you have a class LinkedList, and you are asked to create a class PersistentLinkedList (one that writes out its elements to a stream and can read them back later). If you are tempted to use inheritance from Circle to Cylinder, or from Rectangle to Square, or from LinkedList to PersistentLinkedList, i.e., create a parent-child relationship for any of these cases, you will have problems.
Segregation • Clients should not be forced to depend on methods that they do not use. • ISP deals with the disadvantage of “fat” interfaces (or abstract classes). • ISP recommends to broke up interfaces with a lot of methods into several interfaces.