Decompose Conditional
You have a complicated conditional (if-then-else) statement.
Extract methods from the condition, then part, and else parts.
if (date.before (SUMMER_START) || date.after(SUMMER_END))
charge = quantity * _winterRate + _winterServiceCharge;
else charge = quantity * _summerRate;
![](http://www.refactoring.com/catalog/arrow.gif)
if (notSummer(date))
charge = winterCharge(quantity);
else charge = summerCharge (quantity);
For more information see page 238 of Refactoring
***** 아름다운프로님에 의해서 게시물 복사 + 카테고리변경되었습니다 (2003-12-18 17:27)