-
데이터 구성 : Replace Data Value with ObjectProgramming/리팩토링 2020. 9. 7. 00:38
참고자료
https://refactoring.guru/replace-data-value-with-object
Replace Data Value with Object
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
정의
클래스의 필드에 정의된 변수가 데이터나 동작을 필요로 하는 것이라면
새로운 클래스를 만들어 변수나 동작들을 만든 후, 클래스의 객체를 원래 클래스에 배치를 한다.
기존 예제
변경 후
반응형'Programming > 리팩토링' 카테고리의 다른 글
데이터 구성 : Replace Array with Object (0) 2020.09.10 데이터 구성 : Change Value to Reference, Change Reference to Value (0) 2020.09.07 데이터 구성 : Self Encapsulate Field (0) 2020.09.06 객체 간 기능 이동 : Introduce Foreign Method, Introduce Local Extension (0) 2020.09.06 객체 간 기능 이동 : Extract Class, Inline Class (0) 2020.09.05