Speculative Generality¶
Diagnose a design that carries flexibility for imagined future variation not yet justifying its cost by pricing each abstraction as an unexercised option — with no named consumer, credible timeline, or second concrete instance, it is overhead masquerading as foresight.
Core Idea¶
Speculative generality, named by Martin Fowler, is the code smell in which a design carries flexibility for imagined future variation that has not yet justified its present complexity: a parameter added in case a second value is needed, an abstract base class for a second implementation that never arrives. None of the speculative variants materialize, yet every consumer pays the cognitive, testing, and maintenance overhead of the extra abstraction. The disciplines that defeat it are YAGNI ("you aren't gonna need it") and the rule of three.
Scope of Application¶
Speculative generality lives across the code-quality and maintainability subfields of software, recurring across construct kinds within them.
- Object-oriented design — abstract base classes with one subclass, strategy interfaces wrapping a single algorithm.
- Parameterisation and configuration — parameters taking only one value, knobs no operator has turned.
- API and library design — speculative extension points added before any second consumer exists.
- Frozen-interface design — the in-the-money exception: a public API or schema where belated introduction is expensive.
Clarity¶
Naming speculative generality makes legible a class of errors that masquerade as virtues — foresight, extensibility, defensive design — and so escape criticism. The label recasts each flexibility mechanism as a speculative option whose strike value at decision time is nil, making its present price visible. Its sharper contribution is the distinction the word "extensible" papers over: extensible-and-used versus extensible-and-never-used. Both produce the same abstraction; only the second is overhead.
Manages Complexity¶
A codebase reviewed for over-design presents an assortment of seemingly unlike constructs, each inviting its own architectural debate pulled toward extensibility rhetoric. The smell collapses them to one diagnostic: treat every flexibility mechanism as an option on future variation and ask whether it has a named consumer, a credible timeline, a second concrete instance. That one binary — in-the-money or not — feeds a fixed keep/inline/defer branch turning on two scalars: the probability the variation materializes and the cost of adding it later.
Abstract Reasoning¶
The smell licenses option pricing applied to design: a diagnostic move from an unexercised abstraction to a hidden economic fact (overhead masquerading as foresight); an interventionist inlining response whose predicted effect doubles as a test of the diagnosis; boundary-drawing on the economics (abstraction is bad only when the option is out-of-the-money and late introduction is cheap); and an order-of-events discipline in the rule of three — defer abstraction to the third concrete instance, when the real variation axis is visible.
Knowledge Transfer¶
Within software the smell transfers as mechanism across all of code-quality work and every construct kind — parameter, base class, interface, knob, generic API — carrying the option-pricing diagnostic, the two-scalar economics, and the rule-of-three discipline intact. Beyond software the abstract balance ("anticipated variation should pay rent before driving present complexity") recurs in org design, statute drafting, and infrastructure, but is carried by parent primes parsimony, minimalism, and abstraction — best read as a miscalibration of foresight. The "option pricing" lens is itself an analogy to real-options finance, not a transport.
Relationships to Other Abstractions¶
Current abstraction Speculative Generality Domain-specific
Parents (2) — more general patterns this builds on
-
Speculative Generality is a kind of Code Smell Domain-specific
Speculative Generality is the code-smell species whose unused flexibility provides defeasible evidence that anticipated variation imposed present complexity before earning it.
-
Speculative Generality presupposes Rule of Least Power (Minimum Sufficient Capability) Prime
The speculative-generality verdict presupposes the least-power discipline: unused expressive capability is present structural debt until a real variation requires it.
Hierarchy paths (5) — routes to 5 parentless roots
- Speculative Generality → Code Smell → Evidence → Provenance → Traceability → Observability
- Speculative Generality → Rule of Least Power (Minimum Sufficient Capability) → Constraint
- Speculative Generality → Code Smell → Evidence → Provenance → Attestation → Authentication
- Speculative Generality → Code Smell → Evidence → Provenance → Traceability → Transformation → Function (Mapping)
- Speculative Generality → Code Smell → Evidence → Provenance → Custody Transfer → State and State Transition → Phase Space
Neighborhood in Abstraction Space¶
Speculative Generality sits in a sparse region of the domain-specific corpus (72nd percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.
Family — Financial Markets & Valuation Models (11 abstractions)
Nearest neighbors
- Intermediate-Scale Option (the "missing middle") — 0.84
- Cobweb Model — 0.82
- S&OP Disconnect — 0.82
- Onboarding cliff — 0.82
- Black–Scholes Model — 0.82
Computed from structural-signature embeddings · 2026-07-12