Decompose Conditional

Removes smells
Symptom

Multi-clause conditionals whose meaning isn't obvious from the expression — `if (date.getMonth() >= 5 && date.getMonth() <= 8)` instead of `if (isSummer(date))`.

Goal

Conditions and their consequents read as named domain decisions: isInSummer(), discountFor(date), etc.

Before the refactoring

if (date < SUMMER_START || date > SUMMER_END) {
charge = qty * winterRate + winterFee;
} else {
charge = qty * summerRate;
}

After the refactoring

charge = isSummer(date)
? summerCharge(qty)
: winterCharge(qty);
Example source: Illustrative example written for this site, not a quotation from any source.
Pressure

Readers parse the expression every time; comments accumulate to explain what it means; debugging requires evaluating the expression mentally.

Tradeoff

Names that aren't crisper than the underlying condition add ceremony — only extract when the named function/variable says something the condition can't.

Relief

The branching logic reads top-to-bottom as a story; bugs concentrate in the named pieces.

Trap

Extracting names that aren't crisper than the underlying condition — adds a layer of indirection without revealing intent.