-
데이터 구성 : Replace Array with ObjectProgramming/리팩토링 2020. 9. 10. 22:30
참고자료
https://refactoring.guru/replace-array-with-object
Replace Array 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
정의
배열의 특정 요소가 다른 뜻을 가지고 있다면, 배열을 각각의 요소에 대한 필드를 가지는 객체로 바꾼다.
예시
String[] row = new String[3]; row[0] = "Sunrise"; row[1] = "15"
리팩토링 예시
Performance row = new Performance(); row.setName("Sunrise"); row.setWins("15");
반응형'Programming > 리팩토링' 카테고리의 다른 글
데이터 구성 : Change Value to Reference, Change Reference to Value (0) 2020.09.07 데이터 구성 : Replace Data Value with Object (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