- Duplicated Code in your system
- Multiple ways of representing one concept in your system
- DRY out your code
- Aim for reusable components
- Long methods that are difficult tp understand what they are doing
- Opportunity to refactor with a number of shorter methods
- Name these shorter methods after the intention of the code
- Class violating SOLID principles
- Adhere to SOLID principles
- Making a change to once class requires many changes to many classes all over.
- Opportunity to refactor so that these changes are limited to one class.
- A method is making extensive use of another class that it doesn't belong in.
- Consider moving that method to the class it is using.
- You notice a couple data fields always together like fields in some classes or arguments in some methods.
- These data fields ought to be their own object.
- Using primitive types like a set of integers to define objects in your domain.
- Represent your Domain objects with classes and reap the benefits.
- Often having to switch on the same conditions in your system.
- This is a good step for refactoring. Can think of Polymorphism in this case where you can replace branches of your case statement with passing messages to one of your new objects.