- Feature Envy - method that makes multiple calls to another class
- Data Clumps - multiple fields on a class that belong together in their own class
- Inappropriate Intimacy - Feature Envy in two directions
- Divergent Change (second video) - classes that violate the single responsibility principle
- Duplicate Code - same code in more than one place
- Message Chains - Law of Demeter violation, only interact with your nearest neighbors
- Switch Statements (second video) - use Polymorphism instead
- Lazy Classes (second video) - classes/subclasses that do too little to justify the overhead of their existence
- Data Classes - classes with fields, getters, and setters but nothing that operates on those fields
- Long Parameter Lists - self explanatory, I feel
- Copy/Paste Inheritance - two classes with same/similar fields/operations with not much different between the two
- Long Method - method that does more than it needs to, doesn't necessarily have to be a large method
- Comments - code should mostly be self explanatory
Wednesday, April 13, 2011
Code Smells
Here are a few more links to code videos. Jason Gorman (www.codemanship.com) shows different code smell examples and what to do to get rid of them. All examples are screen casts in Java.
Labels:
Clean Code,
Code Smell,
Polymorphism,
Video
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment