在一个大型函数中,由于局部变量的使用导致无法采用Extract Method
class Order...
double price() {
double primaryBasePrice;
double secondaryBasePrice;
double teriaryBasePrice;
// long computation.
....
}
}
重构:将这个函数放进一个单独对象中,局部变量成了对象内的字段
在一个大型函数中,由于局部变量的使用导致无法采用Extract Method
class Order...
double price() {
double primaryBasePrice;
double secondaryBasePrice;
double teriaryBasePrice;
// long computation.
....
}
}
重构:将这个函数放进一个单独对象中,局部变量成了对象内的字段