-
메소드 정리 : Inline MethodProgramming/리팩토링 2020. 9. 4. 15:20
C++의 인라인 함수랑은 다른 듯..ㅎㅎ
자료참고.
http://factoring.guru/inline-method
Inline Method
Tired of reading? No wonder, it takes 7 hours to read all of the text we have here. Try our interactive course on refactoring. It offers a less tedious approach to learning new stuff. Let's see...
refactoring.guru
정의
함수의 몸체가 함수의 이름만큼 명확할 때, 호출하는 곳에 함수의 몸체를 넣고 메서드를 지우는 작업
예시
// Exameple Code int getRating() { return (moreThanFiveLateDeliveries()) ? 2: 1; } boolean moreThanFiveLateDeliveries() { return _numberOfLateDeliveries > 5; }
리팩토링 예시
// Refactoring Code int getRating() { return (_numberOfLateDeliveries > 5) ? 2 : 1; }
반응형'Programming > 리팩토링' 카테고리의 다른 글
메소드 정리 : Remove Assignments to Parameters (0) 2020.09.04 메소드 정리 : Split Temporary Variable (0) 2020.09.04 메소드 정리 : Replace Temp with Query (0) 2020.09.04 메소드 정리 : Inline Temp (0) 2020.09.04 메소드 정리 : Extract Method (0) 2020.09.04