How do you collapse a full decision table using don't-care entries without losing coverage?
answer
- Merging, not deleting
- Identical actions, one differing condition
- A dash is a claim about behaviour
- Impossible is annotated, not dashed
- Expand the dashes and count
basics
~20 sMerge columns that fire identical actions and differ in exactly one condition, replacing that condition's cell with a don't-care dash. Repeat until nothing merges. Mark unreachable combinations as infeasible instead of dashing them, and re-expand a dash wherever the risk warrants full combinations.
solid answer
~50 sCollapsing is a merge, not a cut. Start from the full table, then look for two columns whose action entries are identical and whose condition entries differ in exactly one row; those two rules always behave the same way, so replace them with a single rule carrying a **don't-care** dash in that row. Repeat until no pair merges, and expect the order of merges to change the final shape without changing its meaning. Two entries look alike on paper and must not be confused: a dash means *either outcome gives these actions*, while an **infeasible** or impossible combination means *this state cannot occur*, and it is annotated and kept rather than quietly folded away. Collapsing reduces the number of test cases to one per surviving rule, but it also hides combinations, so for high-risk rules or where the conditions may interact through shared code you deliberately re-expand a dash and test both concrete values.
code
pseudocode · 10 lines# before: identical actions, differ only in priorityZone
R3: subscriber=Y priorityZone=Y waitOver=N -> surge=N waiveFee=N reserve=N
R4: subscriber=Y priorityZone=N waitOver=N -> surge=N waiveFee=N reserve=N
# after: one rule, dash marks the condition that does not matter here
R3': subscriber=Y priorityZone=- waitOver=N -> surge=N waiveFee=N reserve=N
# count check: a rule with k dashes over yes/no conditions covers 2^k combinations
covered = sum(2 ** dashes(rule) for rule in table) + infeasible_count
assert covered == 2 ** len(conditions)go deeper
Be ready to state the merge rule in one line: two rules with identical actions differing in exactly one condition become one rule with a dash there. Know that a dash is not the same as an untested combination.
Explain the mechanics and the arithmetic: repeat merges until nothing qualifies, and verify with the expansion count where a rule with k dashes stands for 2^k yes/no combinations. Distinguish don't-care from infeasible, unspecified and untested.
Show risk-weighted judgement. Say which rule families you re-expand and test in full, how a defect found inside a dashed rule permanently retires that dash, and how you keep the annotated impossible combinations reviewable when the specification changes.
Own the policy: how large a table is allowed to get before it is split, which risk classes are exempt from collapsing, and how rule coverage on collapsed tables is reported so nobody reads a reduced case count as reduced risk.
## Why collapse at all The untouched table has one column per combination, so the count is the product of each condition's outcome count. Five yes/no conditions give 32 columns; adding two more gives 128. Beyond about twenty columns a table stops being read, stops being reviewed, and stops being maintained, and an unreviewed table is worse than no table because it looks authoritative. Collapsing keeps the table at a size a group of people can walk through in one sitting. ## The merge rule The operation is mechanical: 1. Pick two columns whose **action entries are identical in every row**. 2. Check whether their **condition entries differ in exactly one row**. 3. If both hold, the value of that one condition demonstrably does not change the outcome, so replace the pair with a single column that carries a don't-care mark — conventionally a dash — in that row. 4. Repeat over the reduced table, including over columns that already carry dashes. Stop when no pair qualifies. Two properties are worth stating out loud in an interview. First, the result is not unique: different merge orders produce different but equivalent tables, exactly as different minimisations of a boolean function can. Second, no information is lost by a legal merge, because the merged rule reproduces the actions of both originals for both values of the dashed condition. ## Worked example A ride-hailing dispatcher table has five conditions — subscription active, pickup inside a priority zone, predicted wait over the threshold, driver supply below the floor, rider's stored fare cap exceeded — giving 32 columns. Most of them fire nothing at all: whenever supply is healthy and the wait is short, none of the three actions fires regardless of the other three conditions, and those eight columns merge into one rule with three dashes. Working down the table, a 4-person team collapsed the 32 columns to 11 in about seventy minutes, and the 11 rules were readable enough that a product owner reviewed them the same afternoon. That review is the real return on the collapse. ## Don't-care is not the same as three other things Most of the marks on a mistake-ridden table come from conflating a dash with something else. - **Don't-care**: either outcome produces these actions. A claim about behaviour, and a strong one — it must be justified by the merge, not assumed. - **Infeasible / impossible**: the combination cannot arise in the real system, for instance a rider holding a subscription discount while flagged as never having registered. These are kept and annotated. Deleting them silently loses the audit trail, and they are the first thing to re-check when the specification changes, because a change can make an impossible state reachable. - **Not specified**: the specification never said. This is a defect in the requirement, not a dash. Marking it don't-care hides a missing rule behind a legitimate-looking symbol. - **Not tested**: a scope decision. It belongs in the test plan, not in a cell of a specification artefact. A table that uses one symbol for all four is unreviewable, because a reader cannot tell a decision from an omission. ## What collapsing costs The collapsed table has fewer test cases, and that is the intended saving — but the saving is real only if the don't-care claim is true of the implementation, and the table is built from the specification, not the code. If two conditions happen to be handled by shared logic, a dash can conceal a defect that fires for only one of the two hidden combinations. So treat collapsing as a risk-weighted decision rather than an automatic step: - For low-risk rules, one case per collapsed rule is right. - For rules covering money, safety, access control or anything with a regulatory audience, re-expand the dashes and test each concrete combination. This is sometimes called expanding to full rule coverage for the rules that matter. - If a defect is ever found inside a dashed rule, expand that rule permanently and add the specific combination as a regression case. A dash that has failed once has lost its credibility. ## Reviewing a collapsed table Two checks catch most damage. The **count check**: expand every dash back mentally — a rule with *k* dashes over yes/no conditions stands for 2^k combinations — and confirm the total equals the full combination count minus the annotated infeasible ones. If it does not, either a combination is uncovered or two rules overlap. The **overlap check**: no two rules should match the same concrete combination, because a combination matched by two rules with different actions is a contradiction, and one matched by two rules with the same actions is redundancy that will drift apart at the next edit. A candidate who offers the count check unprompted is showing the thing the technique exists for: the table is only valuable while it is provably complete.
- How do you verify a collapsed table still covers every combination?Expand each rule's dashes arithmetically: over yes/no conditions a rule with k dashes stands for 2^k combinations. Sum those across all rules, add the annotated infeasible combinations, and compare against the product of the condition outcome counts. A shortfall means a missing rule; an excess means two rules overlap, which is either a contradiction or a redundancy.
- When would you deliberately keep the table uncollapsed?When the rules govern money, access, safety or anything with an audit requirement, and when the conditions are likely to share implementation logic so a dash could hide a one-sided defect. Also keep it uncollapsed while the specification is still churning: an expanded table shows exactly which combinations a proposed change touches, and a collapsed one obscures that.
- Does the order in which you merge columns matter?It changes the shape of the result but not its meaning. Different merge orders yield different equivalent collapsed tables, in the same way a boolean expression has several minimal forms. What matters is that every merge was legal — identical actions, one differing condition — and that the count check still balances afterwards.
saying these in an interview costs you the question
- Using a dash to mean the specification never said
- Deleting impossible combinations without recording them
- Merging columns whose actions differ in one row
- Believing a collapsed table always covers every combination
- Collapsing high-risk money or access rules by reflex
- Assuming the collapsed table is unique