- 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
Showing posts with label Clean Code. Show all posts
Showing posts with label Clean Code. Show all posts
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.
Monday, April 4, 2011
Another Clean Code Talk
Here is a link to another Clean Code talk from Google. It's an interesting lecture about removing if statements and switch statements from code using Polymorphism.
Inheritance and Polymorphism
Wednesday, March 30, 2011
Clean Code Talks
Here are a few links to Clean Code talks at Google dealing with unit tests. Pretty interesting and useful information.
Don't Look for Things
Law of Demeter
He teaches that in a constructor you should ask for what you need and don't look for things. Meaning, don't pass in a user object when what you really need is a username and password.
Unit Testing
Subscribe to:
Posts (Atom)