CHECKLIST: Summary of Refactorings

A. Data-Level Refactorings

  1. Replace a magic number with a named constant.
  2. Rename a variable with a clearer or more informative name.
  3. Move an expression inline.
  4. Replace an expression with a routine.
  5. Introduce an intermediate variable.
  6. Convert a multiuse variable to a multiple single-use variables.
  7. Use a local variable for local purposes rather than a parameter.
  8. Convert a data primitive to a class.
  9. Convert a set of type codes to a class or an enumeration.
  10. Convert a set of type codes to a class with subclasses.
  11. Change an array to an object.
  12. Encapsulate a collection.
  13. Replace a traditional record with a data class.

B. Statement-Level Refactorings

  1. Decompose a boolean expression.
  2. Move a complex boolean expression into a well-named boolean function.
  3. Consolidate fragments that are duplicated within different parts of a conditional.
  4. Use break or return instead of a loop control variable.
  5. Return as soon as you know the answer instead of assigning a return value within nested if-then-else statements.
  6. Replace conditionals (especially repeated case statements) with polymorphism.
  7. Create and use null objects instead of testing for null values.

C. Routine-Level Refactorings

  1. Extract a routine.
  2. Move a routineís code inline.
  3. Convert a long routine to a class.
  4. Substitute a simple algorithm for a complex algorithm.
  5. Add a parameter.
  6. Remove a parameter.
  7. Separate query operations from modification operations.
  8. Combine similar routines by parameterizing them.
  9. Separate routines whose behavior depends on parameters passed in.
  10. Pass a whole object rather than specific fields.
  11. Pass specific fields rather than a whole object.
  12. Encapsulate downcasting.

D. Class Implementation Refactorings

  1. Change value objects to reference objects.
  2. Change reference objects to value objects.
  3. Replace virtual routines with data initialization.
  4. Change member routine or data placement.
  5. Extract specialized code into a subclass.
  6. Combine similar code into a superclass.

E. Class Interface Refactorings

  1. Move a routine to another class.
  2. Convert one class to two.
  3. Eliminate a class.
  4. Hide a delegate.
  5. Remove a middleman.
  6. Replace inheritance with delegation.
  7. Replace delegation with inheritance.
  8. Introduce a foreign routine.
  9. Introduce an extension class.
  10. Encapsulate an exposed member variable.
  11. Remove Set() routines for fields that cannot be changed.
  12. Hide routines that are not intended to be used outside the class.
  13. Encapsulate unused routines.
  14. Collapse a superclass and subclass if their implementations are very similar. System-Level Refactorings
  15. Create a definitive reference source for data you canít control.
  16. Change unidirectional class association to bidirectional class association.
  17. Change bidirectional class association to unidirectional class association.
  18. Provide a factory routine rather than a simple constructor.
  19. Replace error codes with exceptions or vice versa.


This topic: Main > WebHome > SoftDev2019 > RefactoringChecklist
Topic revision: r1 - 2020-01-23 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback