Things that might indicate a problem. RailsConf talk "Get a Whiff of This" by Sandi Metz
-
Couplers: binds objects together
- feature envy (send more messages to object than to self)
- inappropriate intimacy (access private methods/data)
- message chains (law of demeter; too many dots)
- middle man (sole purpose to forward on calls)
-
Change Preventers: disuade you from changing code
- divergent change
- shotgun surgery (changing requires massive, all-at-once change)
- parallel inheritance hierarchies (manually keep hiearchies in sync)
-
Dispensables: most common OOP pitfalls
- data class (no behavior/methods)
- duplicated code
- speculative generality (support non-existant future features)
- lazy class (doesn't justify existance)
-
Bloaters: makes code bigger
- data clumps (things passed together)
- large class
- long method
- long paramater list
- primitive obsession (branching based on dumb data)
-
Tool Abusers: misusing OOP constructs
- alternative classes w/ different interfaces
- refused bequest (refusing to implement super class method)
- switch statements
- temporary field
- Martin Fowler & Kent Beck: "Refactoring: Improving the Design of Existing Code"
- Mika Mantyla: http://www.mikamantyla.eu/BadCodeSmellsTaxonomy.html