Quality and reliability × Programming
Business lens: Quality and reliability · Technology lens: Programming
Reading scope: Original synthetic teaching; selected primary background and same-author checks are not independent validation.
A correct program needs a stated rule
A fictional retailer automates inspection of supplier price files. Programming quality begins with an explicit transformation rule and a definition of acceptable output. A script that finishes without an exception may still apply the wrong currency, round prematurely or silently discard a row. Write the business rule in plain language before implementing it. The learner should be able to explain how a source value becomes an output value and what happens when that transformation cannot be justified. Automation reduces repetitive work when its assumptions are visible; it magnifies mistakes when a convenient default or broad exception handler conceals uncertainty.
Bring the rule owners together
Procurement explains the supplier's file conventions, Finance defines currency and rounding expectations, Operations identifies downstream uses and the programmer translates those requirements into checks. Consultation should include staff who currently resolve unusual rows manually. Their examples often reveal conditions missing from the nominal specification. A correction owner needs the original row and a useful reason for rejection. Avoid a generic failure message that forces another department to repeat the entire investigation. Keep input version, program version and rule version together so the same result can be reproduced when a supplier disputes the transformed price.
Worked transformation ledger
A synthetic input has 70 price rows. Fifty-six are transformed correctly under the stated rule, nine are explicitly rejected for missing currency and five produce an incorrect rounded output. Correct transformation coverage is 56/70, or 80%. Appropriate disposition is (56+9)/70, approximately 92.86%, because the five incorrect outputs have not been handled appropriately. Fixing the rounding implementation and rerunning all five affected rows correctly raises correct transformation coverage to 61/70, approximately 87.14%. Nine currency gaps remain rejected. The correction should also include a regression check showing that previously correct rows still satisfy the original rule.
Test boundaries rather than screenshots
An expected-output example should include a normal row, a missing field, a value near a rounding boundary and a repeated identifier. Specify whether repetition is invalid or represents a legitimate update. Python's unittest documentation provides free background for organising explicit checks, but the test's strength depends on the expected result being appropriate. A test that copies the same mistaken calculation into its expectation may pass while teaching nothing. Independently work through a few values and examine rejected states. Do not count a row as corrected merely because a warning disappears after an exception is suppressed.
Extend the cleaning lesson
Use the existing Python-cleaning lesson with invented price rows and a written currency rule. Add a disposition table containing accepted, rejected and incorrectly transformed states, then explain the five-row correction. Keep the exercise compatible with the actual lesson inputs; the 70-row totals are a separate synthetic scenario unless the learner creates them. Record the code or worksheet actually executed and the observed result, including failures. No new downloadable executable fixture is claimed here. The portfolio should show the business rule, independent expected values and a regression check rather than simply reporting that a program ran successfully.
Question words for maintainable code
Who owns the transformation rule and Whom should a rejected row reach? Whose file version is being processed? What rounding behaviour is intended, Where is currency recorded and When should an update replace an earlier value? Why is successful execution insufficient? Which boundary case would expose the bug? How can another person reproduce the result? These questions connect programming to communication, accountability and knowledge transfer. A manager does not need to inspect every line of code, but should understand the rule, consequences and evidence supporting a release. A programmer needs enough business context to avoid implementing an attractive but incorrect shortcut.
Progression and research
Foundation learners trace one source row through the transformation. Undergraduate learners calculate the quality measures and manually verify boundary examples. Postgraduate learners critique the specification, test independence and regression coverage. Research learners ask whether structured rejection reasons reduce resolution effort, using an appropriate comparison and measuring actual correction work. A business-engineering contribution could combine rule clarity, reproducibility and departmental handoffs. For revision, change the rounding assumption and require the learner to identify which expected outputs must change. Preserve the distinction between an implementation defect and unavailable source information; fixing code cannot invent a missing currency reliably.
Study questions and answers
What is initially correct transformation coverage?
56/70 = 80%. Explicit rejection of nine rows is useful disposition, but does not make their transformation correct.
Marking guide: Credit 56/70=80% correct; nine rejected rows are dispositions, not correct transformations.
What changes after the rounding fix?
Correct transformation becomes 61/70 ≈ 87.14%. Nine missing-currency rows remain rejected and need authoritative information.
Marking guide: Credit 61/70=87.14%; nine missing-currency rows remain rejected pending authoritative input.
Why independently calculate expected test values?
Copying implementation logic into the test can reproduce the same error. Independently derived examples check the business rule rather than merely mirroring the code.
Marking guide: Expected values must be independently derived from business rules; mirroring implementation can reproduce its error.
Practice task
Specify a supplier-price rule, a 70-row disposition ledger and independently calculated boundary checks.
Practice bridge
- Specify a supplier-price rule, a 70-row disposition ledger and independently calculated boundary checks.
- Reproduce the stated arithmetic, change one valid assumption and distinguish actual lesson observations from the invented case.
Boundary: Original synthetic teaching connected to an existing bounded or guided lesson. No new executable fixture, catalogue lab or external platform execution claimed.
Sources and further reading
- Python unittest documentation
Scope: Selected explicit-test organisation background; useful checks depend on appropriate independently derived expectations.
Access: Free selected official background; no certificate or enrolment claim.