카탈로그 설명을 보기전에 어떻게 읽으면 좋은지 알아보자.

리팩터링 설명 형식

  • 이름
  • 개요: 핵심 개념이 무엇인가?
    • 나중에 찾아볼 때, 이게 어떤건지 쉽게 떠올리기 위한 것.
  • 배경: 이 기법이 왜 필요한가?
  • 절차: 어떻게 처리하면 되는지에 대한 과정
    • 리팩토링 단계를 작게 나누어 해야하는 지침들.
  • 예시: 실제 코드를 보여준다.
    • 처음에는 예시부터 보자.
    • 그리고 예시는 매우 간단한 것으로 구성했다.

Basic Refactoring

  1. 12. Extract Function
  2. 13. Inline Function
  3. 14. Extract Variable
  4. 15. Inline Variable
  5. 16. Change Function Declaration
  6. 17. Encapsulate Variable
  7. 18. Rename Variable
  8. 19. Make Parameter Object
  9. 20. Combine Functions into Class
  10. 21. Combine Functions into Transform
  11. 22. Split Phase

Encapsulation

  1. 23. Encapsulate Record
  2. 24. Encapsulate Collection
  3. 25. Replace Primitive with Object
  4. 26. Replace Temp With Query
  5. 27. Extract Class
  6. 28. Inline Class
  7. 29. Hide Delegate
  8. 30. Remove Middle Man
  9. 31. Substitute Algorithm

Move Features

  1. 32. Move Function
  2. 33. Move Field
  3. 34. Move Statement into Function
  4. 35. Move Statements to Callers
  5. 36. Replace Inline Code With Function Call
  6. 37. Slide Statements
  7. 38. Split Loop
  8. 39. Replace Loop with Pipeline
  9. 40. Remove Dead Code

Data Organization

  1. 41. Spilt Variable
  2. 42. Rename Field
  3. 43. Replace Derived Variable With Query
  4. 44. Change Reference To Value
  5. 45. Change Value To Reference

Simplifying conditional logic

  1. 46. Decompose Conditional
  2. 47. Consolidate Conditional Expression
  3. 48. Replace Nested Conditional With Guard Clauses
  4. 49. Replace Conditional With Polymorphism
  5. 50. Introduce Special Case
  6. 51. Introduce Assertion

API Refactoring

  1. 52. Separate Query From Modifier
  2. 53. Parameterize Function
  3. 54. Remove Flag Argument
  4. 55. Preserve Whole Object
  5. 56. Replace Parameter With Query
  6. 57. Replace Query with Parameter
  7. 58. Remove Setting method
  8. 59. Replace Constructor with Factory Method
  9. 60. Replace Function with Command
  10. 61. Replace Command with Function

Dealing with Inheritance

  1. 62. Pull up Methods
  2. 63. Pull up Field
  3. 64. Pull up Constructor Body
  4. 65. Push down Method
  5. 66. Push down Field
  6. 67. Replace Type Code with SubClasses
  7. 68. Remove Subclass
  8. 69. Extract SuperClass
  9. 70. Collapse Hierarchy
  10. 71. Replace SubClass with Delegate
  11. 72. Replace SuperClass with Delegate

Reference