Interview frequency: …
Short answer
No software client should be forced to depend on methods or interfaces it does not use, avoiding unnecessary coupling and unjustified recompilation.
Explanation
When an interface contains dozens of unrelated methods (a God Interface), every implementing class must write empty methods or throw errors for operations it does not need. Any change to one method also forces all implementing classes to be recompiled and retested. Split the fat interface into smaller, precise interfaces focused on specific roles (Role Interfaces).
Code example
// Precisely separated interfaces:
interface Printer {
print(doc: Document): void;
}
interface Scanner {
scan(): Document;
}
class BasicPrinter implements Printer {
print(doc: Document) { /*...*/ }
}Common mistakes
- Combining every CRUD, reporting, and export operation for all entities into one broad repository interface.