Refactoring

Basics
  • Explain why code should be refactored
  • Explain why readability of code is crucial
  • Discuss the scope of code to be refactored
  • Differentiate refactoring with agile development
  • Show the relation of refactoring and maintenance effort
  • Discuss the relations between refactoring and testing
  • Explain what an anti-pattern is
  • Define a code smell
Keywords: code smell, anti-pattern, agile development, test driven development, testing, clean code General Issues
  • Discuss the evil of duplicated code
  • Discuss the problem of dead code
  • Simplify conditional and other expressions
Keywords: duplicated code, dead code, magic numbers Modules
  • Discuss the appropriateness of dependencies between classes
  • Discuss the problem of divergent changes
  • Detect the possibility to refactor existing code to use polymorphismus
Keywords: feature envy, data clumps, primitive obsession, parallel inheritance hierarchy, message chains, middle man, refused bequest, incomplete library class, coupling, divergent changes, shotgun surgery, switch statements, speculative generality Classes
  • Examine the cohesion of a class
  • Identify classes having more than one responsibility
  • Examine the length of a class
Keywords: large class, lazy class, temporary fields, inappropriate intimacy, inappropriate static, value object Methods
  • Examine the levels of abstraction used inside a method
  • Examine the proper size and length of lines and methods
  • Classify the parameter list of a method
  • Examine the type of parameters
Keywords: long method, long parameter list, output arguments, flag arguments, level of abstraction Naming and Comments
  • Review proper naming for variables, fields, properties, function and classes
  • Examine the expressiveness of the name of an element compared to what the code really does
  • Distinguish between appropriate and inappropriate comments
Keywords: expressiveness, naming convention, inappropriate information, obsolete comment, redundant comment, poorly written comment, commented-out code Exception Handling
  • Identify awkward exception handling strategy
  • Explain why using flags to indicate an exceptional state is suboptimal
  • Detect the difficulties of using null in the scope of an exceptional program state
Keywords: flags, try-catch-ignore, null Legacy Code
  • Improve legacy code to use state of the art API (Java 1.6)
  • Identify obsolete patterns (Java 1.4 and previous)
  • Determine flawed and ineffective code caused by improper use of the API
Keywords: enum, static imports, for each, generics, boxing, unboxing, varargs

Note: Do not add any questions about Java 5 features without a clear relation how the problem has been solved with Java 1.4

你可能感兴趣的:(refactor)