SOLID PrinciplesInterface Segregation PrincipleHard⏱️ ~3 min

ISP Trade-offs: When to Use vs When It's Overkill

ISP improves flexibility and decoupling, but it is not free. Understanding when to apply ISP versus accepting a simpler unified interface requires analyzing your specific context.

When to Apply ISP

First, apply ISP when multiple distinct client types exist. If PayrollSystem, WorkScheduler, and HRPortal each use different subsets of an Employee interface, segregate it. Each client sees only what it needs.

Second, apply ISP when some implementations cannot meaningfully provide certain methods. A ReadOnlyFile cannot implement write(). Forcing it into a File interface with write() leads to runtime exceptions or no-op stubs, both harmful.

Third, apply ISP in plugin architectures where third-party implementations extend your system. Smaller interfaces lower the barrier to entry. A plugin author can implement Renderable without also implementing Serializable if those are segregated.

Fourth, apply ISP when interface changes are frequent in some areas but not others. Splitting a DocumentProcessor into Readable and Writable means changes to read logic do not force recompilation of write-only clients.

When ISP Is Overkill

Cohesive operations: If methods always appear together, keep them in one interface. A Stack with push(), pop(), and peek() should not be split. No client uses only push without pop. Splitting reduces clarity without adding flexibility.

Stable, narrow interfaces: An interface with two or three methods that rarely change and apply to all implementations does not need segregation. A Comparable interface with compareTo() is fine as-is. Over-segmentation creates interface proliferation without benefit.

Single implementation type: If only one class will ever implement the interface, ISP provides no value. The interface exists for polymorphism or dependency inversion, not to serve multiple clients. Premature segregation increases complexity.

Performance-critical tight coupling: In rare embedded or high-performance scenarios, interface dispatch overhead matters. If profiling shows that interface calls are a bottleneck and all clients need all methods anyway, a unified interface may be appropriate. But optimize only after measurement confirms the need.

ISP vs Alternatives

ISP (Multiple Interfaces)
Pros: Maximum client decoupling, flexible composition, clear contracts.
Cons: More interfaces to maintain, navigation complexity, potential over-engineering.
Use when: Multiple client types exist with distinct needs.
Single Cohesive Interface
Pros: Simplicity, single point of reference, easier navigation.
Cons: Clients see methods they do not use, implementers handle all methods.
Use when: Operations are cohesive and all clients need most methods.
Adapter Pattern
Pros: Keeps original interface intact, adapts per client.
Cons: Extra adapter classes, indirection overhead.
Use when: You cannot change the existing interface (third-party library).
Facade Pattern
Pros: Simplifies complex subsystems, provides coarse-grained interface.
Cons: Still one interface per facade, not fine-grained role segregation.
Use when: Clients need a simplified view of a complex subsystem, not role-based slices.
Interview Tip: When asked if your design violates ISP, respond with: Does this interface serve multiple client types with different needs? If yes, segregate. If no, justify why one interface suffices.

Decision Framework: Count distinct client types and their method usage. If Client A uses methods 1-3, Client B uses methods 4-6, and they never overlap, apply ISP. If most clients use 80% of methods, ISP adds little value.

💡 Key Takeaways
Apply ISP when multiple client types use different method subsets
Apply ISP when some implementations cannot provide certain methods
Skip ISP when methods are cohesive and always used together
Skip ISP for stable, narrow interfaces with universal applicability
ISP increases interface count; justify the complexity with real decoupling benefits
📌 Examples
1Apply: Document interface serving ReadOnlyViewer and FullEditor clients separately
2Skip: Stack interface with push, pop, peek used together by all clients
← Back to Interface Segregation Principle Overview