An interface should be a focused toolbox, not a junk drawer. The Interface Segregation Principle (ISP) says a class should not have to implement methods it does not use. Keep each interface specific to the role its clients need. section 3.4.4
Think of soccer practice: a midfielder needs shooting and tackling drills, not goalie-specific diving saves. In software, forcing a midfielder class to provide unused goalie methods creates useless code, often with errors thrown from methods that should never be called. A bloated interface also couples clients to changes in methods they do not use. section 3.4.4 section 3.4.4
Listing 3.9 “Before”: Violating ISP - “Fat Interface”
class Midfielder {
practiceShooting() { /* ... */ }
practiceTackling() { /* ... */ }
practiceDivingSaves() { #A
throw new Error("practiceDivingSaves() is not implemented."); #B
}
practiceHandDistribution() { #A
throw new Error("practiceHandDistribution() is not implemented."); #B
}
}The bloated version gives Midfielder goalie methods that only throw errors. section 3.4.4
Listing 3.10 “After”: Following ISP
class Midfielder {
practiceShooting() { /* ... */ }
practiceTackling() { /* ... */ }
}
class Goalie {
practiceShooting() { /* ... */ }
practiceTackling() { /* ... */ }
practiceDivingSaves() { /* ... */ }
practiceHandDistribution() { /* ... */ }
}The focused version gives Midfielder and Goalie methods suited to their roles. section 3.4.4
Use ISP to keep related methods together and let each client depend only on what it needs. The aim is not small interfaces for their own sake, but less confusion and less coupling when code changes. section 3.4.4



