Interface Segregation Principle
Also Known As
ISP
Interface Segregation Principle
fat interface
TL;DR
Clients should not be forced to depend on interfaces they do not use — prefer many small, focused interfaces over one large one.
Explanation
The I in SOLID, ISP states that a class implementing an interface should not be forced to implement methods it doesn't use. Fat interfaces that bundle unrelated methods force implementors to provide stub implementations for irrelevant methods. The solution is to split large interfaces into smaller, cohesive ones and have classes implement only what they need. This complements the Dependency Inversion Principle — depend on the narrowest interface needed for the task.
Common Misconception
✗ One large interface is simpler to manage than many small ones. A large interface forces implementors to stub out methods they do not use, creating misleading no-op implementations and tight coupling to functionality the implementor does not need.
Why It Matters
The Interface Segregation Principle prevents classes from being forced to implement methods they don't use — large interfaces create fake implementations and hide which capability is actually needed.
Common Mistakes
- One large repository interface with 20 methods — every implementation must stub 15 unused ones.
- Adding new methods to an existing interface instead of extending it — breaks all implementors.
- Not splitting interfaces at natural capability boundaries — Readable, Writable, Listable rather than FileRepository.
- Confusing ISP with SRP — ISP is about interface design, SRP is about class responsibility.
Code Examples
✗ Vulnerable
interface Worker {
public function work(): void;
public function eat(): void; // robots don't eat!
public function sleep(): void; // robots don't sleep!
}
class RobotWorker implements Worker {
public function eat(): void { throw new \Exception('Robots do not eat'); }
public function sleep(): void { throw new \Exception('Robots do not sleep'); }
}
✓ Fixed
interface Workable { public function work(): void; }
interface Feedable { public function eat(): void; }
interface Restable { public function sleep(): void; }
class HumanWorker implements Workable, Feedable, Restable { ... }
class RobotWorker implements Workable { ... }
Tags
🤝 Adopt this term
£79/year · your link shown here
Added
15 Mar 2026
Edited
22 Mar 2026
Views
33
🤖 AI Guestbook educational data only
|
|
Last 30 days
Agents 1
No pings yesterday
Perplexity 9
Amazonbot 7
Ahrefs 5
Unknown AI 2
Google 2
ChatGPT 2
Majestic 1
SEMrush 1
How they use it
crawler 27
crawler_json 2
Related categories
⚡
DEV INTEL
Tools & Severity
🟡 Medium
⚙ Fix effort: Medium
⚡ Quick Fix
Split fat interfaces into small focused ones — clients should only implement what they actually use; a class implementing an interface with unused methods is a sign of violation
📦 Applies To
any
web
cli
queue-worker
🔗 Prerequisites
🔍 Detection Hints
Interface with 10+ methods; class implementing interface throwing UnsupportedOperationException on some methods; fat PSR interface
Auto-detectable:
✗ No
phpstan
psalm
⚠ Related Problems
🤖 AI Agent
Confidence: Medium
False Positives: High
✗ Manual fix
Fix: High
Context: Class
Tests: Update