Consolidate Conditional Expression
You have a sequence of conditional tests with the same result.
Combine them into a single conditional expression and extract it.
double disabilityAmount() {
if (_seniority < 2) return 0;
if (_monthsDisabled > 12) return 0;
if (_isPartTime) return 0;
// compute the disability amount
![](http://www.refactoring.com/catalog/arrow.gif)
double disabilityAmount() {
if (isNotEligableForDisability()) return 0;
// compute the disability amount
For more information see page 240 of Refactoring
***** 아름다운프로님에 의해서 게시물 복사 + 카테고리변경되었습니다 (2003-12-18 17:27)