Complex Conditional

Definition:

  • A conditional expression is composed of many boolean conjunctions.

Code Example:

function calculateAmount(integer year) return float {
  var float amount;
  if (( (year mod 4) == 0 and not (year mod 100) == 0 ) or (year mod 400) == 0 ) {
    amount := BASE AMOUNT ∗ 366;
  } else {
    amount := BASE AMOUNT ∗ 365;
  }
  return amount;
}

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring