Single choice principle
From CSSEMediaWiki
(Difference between revisions)
Line 9: | Line 9: | ||
* [[Refactoring]] | * [[Refactoring]] | ||
* [[Strategy]] | * [[Strategy]] | ||
+ | * [[Switch statement smell]] (Espically, the same switch statement in many places) |
Revision as of 11:06, 29 September 2010
This states that whenever a program needs to support a set of known alternatives, this set should only exist in one module. Repeating the alternatives in several modules is unnecessary and makes it hard to maintain when an alternative is added or removed.
See also
- Design maxims
- Once and only once
- Duplicate code smell
- Don't repeat yourself
- Code smells
- Refactoring
- Strategy
- Switch statement smell (Espically, the same switch statement in many places)