3. Causes for refactoring Code duplicating; Huge method; Huge or deep loops; Bad class coherency; Bad interface agreement (Interface monster); Too many parameters in method; Too much class’s responsibilities;
4. Causes for refactoring It’s necessary to make changes in several classes; It’s necessary to change several hierarchies; It’s necessary to make changes in several case blocks; Coherent data placed not in a class; Method use more parameters from other class than its; Elementary type is overload;
5. Causes for refactoring Class has limited functionality; Method gets Tramp data; One class knows too much about another one; Method has unlucky name; Public fields; Inherited class used small dime of base methods; Code Comments; Class contains methods that could be some time;
6. Data Refactoring Magic numbers; Unlucky variable name; Temporary variable using; Multiple usage of the same variable; Enum usage; Basic type expansion;
7. Operator Refactoring Decomposition of expression; Extract Boolean methods; Immediate exit from method; Polymorphism usage; Dummy objects usage;
8. Methods Refactoring Method extraction; Inline method; Class extraction from huge methods; Additional parameters usage; Redundant parameters deletion; Pass whole class instead of several parameters; Return base classes;
9. Class Refactoring Value to Reference types replacement; Reference to Value types replacement; Move fields/properties/methods to base class; Move fields/properties/methods to inherited class; Move methods to another class; Split one class to many; Delete useless class; Use extension methods;
10. Class Refactoring Replace inheritance to delegating; Replace delegating to inheritance; Data encapsulating; Unite inherited and base class.
11. Safe Refactoring Save original code; Make refactoring step-by-step; Create list of actions; Create To-Do list; Create check points; Monitor warnings from compiler; Make change-reviews.
12. Bad causes to do refactoring Do not expect refactoring to correct your code; Do not wait for some magic from refactoring.
13. Refactoring strategies Use refactoring when you: Create new methods; Create new classes; Fix defects; Create refactoring in bug’s potential code; Create refactoring in complicated modules.