Form a class base on group of functions that operate closely on a common data
(공통 데이터를 중심으로 작동하는 함수들을 발견할 시 클래스 하나로 묶기)
function base(aReading) {}
function taxableCharge(aReading) {}
function calculateBaseCharge(aReading) {}
to
class Reading() {
base() {}
taxableCharge() {}
calculateBaseCharge() {}
}
Encapsulate common data shared by functions.
함수들이 공유하는 공통 데이터 레코드를 캡슐화한다.
Move functions using common data to a new class
공통 레코드를 사용하는 함수 각각을 새 클래스로 옮긴다.(함수 옮기기)
Logic manipulating data is extracted as a function and transferred to a new class
데이터를 조작하는 로직들은 함수로 추출해서 새 클래스로 옮긴다.