Skip to content
Preptima
mediumConceptScenarioMidSeniorStaff

This interface has twelve methods and every implementation throws UnsupportedOperationException for four of them. What went wrong, and how would you fix it?

5 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

The interface was assembled from the union of what implementations do rather than from what any one caller needs, so no implementation can honour the whole contract. Split it by client into role interfaces, working from the call sites rather than from the classes.

Was this answer helpful?

Likely follow-ups

  • Where should each new interface physically live, and which side of the boundary owns it?
  • One caller genuinely needs every method. Has the split bought you anything at all?
  • The JDK ships collection interfaces with optional operations. Why was that a defensible trade there?
  • How would you perform this split on an interface other teams already implement?

Related questions

Related Topics