Code Smells

Code Smells / Dispensables / Speculative Generality

Speculative Generality code smell icon

Speculative Generality

Speculative Generality is where code is written with so much caution for possible future changes, that the code becomes unnecessarily complex and harder to read.

It is considered good practice to consider possible future development when writing code, but Speculative Generality is when this is overdone. The balance can be hard to find, but a good understanding of the purpose of your code will help you make the best judgements.

Speculative Generality smells are unique among code smells in that it is usually experienced programmers who create them.

Left chevron Right chevron