概括
代码对一个参数进行赋值。
以一个临时变量取代该参数的位置。
例子
int discount( int inputVal, int quantity, int yearTodate){
if(inputVal > 50)
inputVal = - 2;
}
重构后
int discount( int inputVal, int quantity, int yearTodate){
int result = inputVal;
if(inputVal > 50)
result = - 2;
}
对参数赋值降低了代码的清晰度。
做法
.
实践
.