Curriculum

Curriculum

State Hidden Assumptions as Constraints

Scenario

A rule says "A reader may hold up to 3 books." Two teammates disagree on whether an overdue book blocks borrowing.

Selected choicePick a choice below
Result—

Try it yourself

Compare each assumption against an explicit contract constraint.

Reveal the explanation
  1. Assume every reader has whole-number books and no overdue items

    Risky hidden assumption. Another developer or AI agent may enforce a different rule.

  2. Constraint: borrowedCount is a non-negative integer; checkout requires borrowedCount < 3

    Clear numeric constraint. Negative counts and fractions are explicitly excluded.

  3. Constraint: overdue status is out of scope for v1 and ignored by this function

    Clear scope boundary. Both teammates know not to invent an extra parameter.

Writing constraints explicitly—including what is out of scope—prevents silent mismatches between specification, code, and tests.

Your turn

List two explicit constraints for a study-room seat count input (e.g., whole integer, maximum room capacity 12).

Common mistake Leaving out whether zero seats or fractional numbers like 1.5 are allowed.

Check your work

Two written constraints naming allowed type and numeric bounds.

Quick check

What happens when a hidden assumption (like "scores cannot exceed 100") is left out of the specification?
Show the answer and reasoning

Correct answer Two implementations may handle score = 120 differently

Without a stated constraint, one implementation might return Pass for 120 while another rejects it as invalid.