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.

Books about code smells

Learn to write better smelling code.

Refactoring: Improving the Design of Existing Code book cover

Refactoring: Improving the Design of Existing Code

Code smells: A Predictor of Remarkable Quality Improvement book cover

Code smells: A Predictor of Remarkable Quality Improvement

Clean Code: A Handbook of Agile Software Craftsmanship book cover

Clean Code: A Handbook of Agile Software Craftsmanship

I receive a commission on sales made from the above affiliate links.