Maybe something (contrived) like this providing no-op defaults?
total = calculateOrderTotal(user.order);
if (user.isPremiumMember) {
total = total * 0.9; // 10% discount
versus total = calculateOrderTotal(user.order);
discount = calculateDiscount(user); // Returns 0.9 or 1.0
total = total * discount;Didn't you just shift the branch to the calculateDiscount() function?
OK, or maybe...