CodePark/ questions / SOLID
START PRACTICINGPRACTICE
Backend question · Software design & patterns › SOLID

A FileStorage interface has upload, download, getSignedUrl and transcodeVideo. The LocalDiskStorage used in tests throws "not supported" for getSignedUrl and transcodeVideo. Which principle points most directly to the fix?

Interface Segregation Principle

The right answer is the Interface Segregation Principle (ISP). ISP says clients should not be forced to depend on methods they don't use. The fix is to split the "fat" interface into smaller ones, such as BlobStore and VideoTranscoder. Then LocalDiskStorage implements only what it supports.

The methods that throw "not supported" are also an LSP (Liskov Substitution Principle) smell. But splitting the interface is what removes them, so ISP points most directly to the fix.