·
BAD EXAMPLE
if (value > 500) { applyDiscountForGreaterThan500(); } else if (value > 1000) { applyDiscountForGreaterThan1000(); }
GOOD EXAMPLE
// encapsulated ifs in the methods
applyDiscountIfValueIsGreaterThan500();
applyDiscountIfValueIsGreaterThan1000();