Tuesday, April 22, 2008

Common code smells

Type codes and switch statements are common code smells. In addition, there are quite some other code smells that are also very common. Below is a summary list:

- Duplicate code.
- Too many comments.
- Type code.
- Switch or a long if-then-else-if.
- Cannot give a good name to a variable, method or class.
- Use names like XXXUtil, XXXManager, XXXController and etc.
- Use the words "And", "Or" and etc. in the name of a variable, method or class.
- Some instance variables are not always used.
- A method contains too much code.
- A class contains too much code.
- A method takes too many parameters.
- Two classes are using each other.

No comments: