I'll Be Backend
Principles

Interface Segregation Principle: Split a Fat Interface

The Interface Segregation Principle says no caller should be forced to depend on methods it does not use: give each caller an interface with only the methods it calls. These lessons take a shop's Inventory interface whose three callers each use one method, so a read-only cache has to throw from two methods it never needed, and split it into one small interface per caller.

Pick your language

When to use it

Use it when

An implementation must stub or throw in methods its callers never call, or callers use separate slices of one interface.

Skip it when

Every caller uses the whole interface. A small Repository whose one service calls both find and save is fine as it is.

Spot it by

Methods that throw UnsupportedOperationException or do nothing only to satisfy an interface, and test fakes that stub methods the test never calls.