DispensablesLow

Speculative Generality: What It Costs and How to Fix It

Abstractions, parameters, and classes created for anticipated future needs that never materialised.

Model cost, team of 8$2K-$6K/yr
Severity
2/5
CategoryDispensables
Detection4 tools

What It Is

Speculative Generality occurs when developers create abstractions, interfaces, parameters, or entire class hierarchies 'in case we need them later.' The anticipated use case never arrives, but the abstraction remains, adding complexity that every future developer must understand. Common manifestations include: abstract classes with only one subclass, interfaces implemented by only one class, unused parameters passed through 'for future extensibility,' and factory patterns wrapping a single concrete class.

Threshold: Any abstraction (interface, abstract class, factory) with only one concrete use and no test doubles is speculative. If you have to explain 'we might need this later,' delete it.

Why It Costs Money

1

Every unnecessary abstraction is a concept that developers must understand. When a developer encounters an interface with one implementor, they must figure out whether there is a reason for the interface or whether it is speculative. This investigation wastes 15-30 minutes per encounter.

2

Speculative abstractions make the correct change path unclear. Should the developer modify the interface, the implementation, or add a new implementation? The abstraction suggests that extension is the intended approach, even when modification is simpler.

3

Testing overhead increases. Abstract factories, strategy patterns, and interface hierarchies require more test infrastructure than direct implementations, even when only one variant exists.

Specific Cost Mechanisms

  • ●Comprehension overhead: each speculative abstraction is one more thing a new hire has to learn
  • ●Decision paralysis: developers unsure whether to extend or modify the speculative structure
  • ●Test infrastructure: unnecessary mocks and test doubles for single-implementation interfaces

Estimated Annual Cost

Cost of one instance a year by team size, from our model at $180K fully-loaded cost per engineer. Low and high use the bottom and top of the Low inputs; mid is halfway. See full methodology.

Team SizeLowMidHigh
3 devs$700$2K$3K
5 devs$1K$3K$4K
8 devs$2K$4K$6K
10 devs$2K$5K$7K
20 devs$5K$9K$14K

These are model outputs, not measurements. Every input is on the cost model page, and the same model produces the figures on the 22 smells page. Put in your own team and cost in the smell profile calculator.

How to Detect It

Specific rules and thresholds for automated detection. See full tool comparison.

SonarQube
squid:S1694 / squid:S1609

Abstract class without abstract methods, functional interface with one use

CodeClimate
method-count / file-lines

Small classes/interfaces with single implementations

PMD
AbstractClassWithoutAbstractMethod / UnusedFormalParameter

Unused abstractions and parameters

IntelliJ IDEA
Class with single implementor

Directly detects single-implementation interfaces

Refactoring Patterns

Proven techniques to eliminate this smell. See all refactoring patterns.

Collapse Hierarchy

An abstract class has only one concrete subclass

Effort (our estimate): 1-2 hours
Impact: Removes one level of indirection

Inline Class

An interface has only one implementation and no test double

Effort (our estimate): 30-60 minutes
Impact: Eliminates unnecessary abstraction layer

Remove Parameter

A parameter is passed through but never used

Effort (our estimate): 15-30 minutes per parameter
Impact: Simplifies method signatures and call sites

Related Smells

Updated November 2026