Speculative generality smell
From CSSEMediaWiki
(Difference between revisions)
m (category) |
m (Reverted edits by Ebybymic (Talk); changed back to last version by Matthew Harward) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
* [[You ain't gonna need it]] | * [[You ain't gonna need it]] | ||
* [[Code smells]] | * [[Code smells]] | ||
+ | |||
+ | {{Template:CodeSmells}} | ||
[[Category:Code smells]] | [[Category:Code smells]] |
Latest revision as of 03:03, 25 November 2010
This code smell describes a situation where people develop a class with all sorts of hooks and special cases just so it will handle things that might be required in the future but not at this stage. The resulting class is often harder to understand and maintain than if it only tried to handle the things that were actually required.
Speculative generality can usually be spotted when the only users of a method are test cases. Such methods should be removed unless it contains functionality that is needed by other parts of the system.
This code smell is inline with You ain't gonna need it in that it says that you shouldn't develop functionality unless you need it.
See also