Decision Tables for Small Business Rules

A decision table lists the relevant input cases and their expected outcomes before mapping them to implementation branches.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
2 min
In this article4 chapters
  1. Choose independent dimensions
  2. Detect exceptions before coding
  3. Design outcomes for conflicting attributes as well as normal ones
  4. Use rows as tests for the resulting implementation

Choose independent dimensions

A delivery fee may depend on destination zone and parcel weight class. For two zones and three classes, enumerate six rows. Record the fee for each and check for unintended gaps. Use condition coverage to handle requests outside those declared values.

Detect exceptions before coding

Suppose heavy parcels are unavailable in the second zone. One row should record unavailability explicitly instead of using an arbitrary fee. Test that row independently. When several rows share a rate, compare the table against the truth table for conditions before simplifying the implementation.[1][2]

Design outcomes for conflicting attributes as well as normal ones

A delivery service can list three weight classes for local and regional delivery. The table has six ordinary rows. It can show four credits for a light local parcel, seven for a light regional parcel, and an unavailable result for a heavy regional parcel. Treat unavailable as an explicit result rather than assigning a fake price. Draw both dimensions and mark which pairs are legal under the function contract. This makes the rule reviewable even before it has been implemented.

Use rows as tests for the resulting implementation

For each allowed row, check the result and any work the selection permits. Then test an unknown zone and a weight at a classification boundary. If several rows share an amount, consider eliminating repeated calculation without deleting their test cases. Two cases may give the same price now while retaining independent policy meanings. See classifying by thresholds.

When a new zone is introduced, add its rows first. A default branch written before the new cases can accidentally send it through the old local fee. The table can test this evolution by showing which unknown values are rejected and which are now recognized.

References

  1. Python Software Foundation, Python Tutorial: Control Flow ↩
  2. Python Software Foundation, Python Language Reference: Expressions ↩