본문 바로가기
백엔드/Java

리팩토링 맛보기 2탄

by david100gom 2020. 1. 26.
728x90

 

  • Replace Magic Number with Symbolic Constant (매직 넘버를 기호 상수로 치환)
  • Rename Method (메서드명 변경)
  • Introduce Explaining Variable (설명용 변수 도입)
  • Split Temporary Variable (임시 변수 분리)
  • Inline Temp (임시 변수 인라인화)
  • Replace Temp with Query (임시 변수를 질의로 치환)
  • Remove Control Flag (제어 플래그 삭제)
  • Decompose Conditional (조건문 분해)
  • Consolidate Duplicate Conditional Fragments (중복된 조건문 조각 모음)
  • Replace Nested Conditional with Guard Clauses (가드절로 중첩 조건문 치환)
  • Consolidate Conditional Expression (조건식 통합)
  • Introduce Null Object (널 객체 도입)
  • Replace Conditional with Polymorphism (다형성으로 조건문 치환)
  • Replace Error Code with Exception (에러 코드를 예외로 치환)
  • Replace Exception with Test (예외를 조건 판정으로 치환)
  • Replace Constructor with Factory Method (생성자를 팩토리 메서드로 치환)
  • Extract Class (클래스 추출)
  • Inline Class (클래스 인라인화)
  • Extract Subclass (하위 클래스 추출)
  • Collapse Hierarchy (계층 평탄화)
  • Extract Superclass (상위 클래스 추출)
  • Extract Interface (인터페이스 추출)
  • Introduce Foreign Method (외부 메서드 도입)
  • Introduce Local Extension (지역 확장 도입)
  • Encapsulate Field (필드 캡슐화)
  • Self Encapsulate Field (자기 캡슐화)
  • Encapsulate Collection (컬렉션 캡슐화)
  • Encapsulate Downcast (다운캐스트 캡슐화)
  • Remove Setting Method (세터 메서드 삭제)
  • Seperate Query from Modifier (질의와 갱신 분리)
  • Move Field (필드 이동)
  • Push Down Field (필드 내리기)
  • Pull Up Field (필드 올리기)
  • Move Method (메서드 이동)
  • Push Down Method (메서드 내리기)
  • Pull Up Method (메서드 올리기)
  • Pull Up Construtor Body (생성자 본체 올리기)
  • Hide Method (메서드 은폐)
  • Extract Method (메서드 추출)
  • Inline Method (메서드 인라인화)
  • Introduce Assertion (어서션 도입)
  • Substitute Algorithm (알고리즘 교체)
  • Replace Mehtod with Method Object (메서드를 메서드 객체로 치환)
  • Remove Parameter (매개변수 삭제)
  • Add Parameter (매개변수 추가)
  • Remove Assignments to Parameters (매개변수에 할당 제거)
  • Replace Parameter with Explicit Methods (매개변수를 명시적인 메서드 그룹으로 치환)
  • Parameterize Method (메서드 매개변수화)
  • Preserve Whole Object (객체 자체 전달)
  • Replace Parameter with Method (매개변수를 메서드로 치환)
  • Introduce Parameter Object (매개변수 객체 도입)
  • Replace Type Code with Class (분류 코드를 하위 클래스로 치환)
  • Replace Type Code with State/Strategy (분류 코드를 상태/전략 패턴으로 치환)
  • Replace Subclass with Fields (하위 클래스를 필드로 치환)
  • Replace Array with Object (배열을 객체로 치환)
  • Replace Data Value with Object (데이터값을 객체로 치환)
  • Replace Record with Data Class (레코드를 데이터 클래스로 치환)
  • Convert Procedural Design to Objects (절차적 설계를 객체로 변환)
  • Change Value to Reference (값을 참조로 변경)
  • Change Reference to Value (참조를 값으로 변경)
  • Duplicate Observed Data (관측 데이터 복제)
  • Separate Domain from Presentation (프레젠테이션과 도메인 분리)
  • Replace Inheritance with Delegation (상속을 위임으로 치환)
  • Replace Delegation with Inheritance (위임을 상속으로 치환)
  • Hide Delegate (대리자 은폐)
  • Remove Middle Man (중재자 제거)
  • Form Template Method (템플릿 메서드 형성)
  • Tease Apart Inheritance (상속 구조 정리)
  • Extract Hierarachy (계층 추출)
  • Change Bidirectional Association to Unidirectional (양방향 관계를 단방향으로 변경)
  • Change Unidirectional Association to Bidirectional (단방향 관계를 양방향으로 변경)

 

참고 서적 : 자바로 배우는 리팩토링 입문 (http://www.yes24.com/Product/Goods/55147071?scode=032&OzSrank=1)

728x90

댓글