• Part of every calculation code deliverable should be another program that independently calculates key subtotals and totals.

    The second program can be a set of sql scripts with instructions to fill in the parameters as you go, but they should exist. They should be built at the same time.

    If the two programs do not agree, it's certain that the calculation in one of them is wrong. Reconciling the differences leads to additional assurance that the main program is working correctly.

    If data is being transformed from one system into another as part of the calculation, the mechanism for doing so should include an audit data structure such that one can easily write a query that shows exactly which source records were included in exactly which destination subtotals. This is invaluable for quickly identifying lost or double-counted records. When built into the initial design, it's actually faster to build the main program and the double-check program than it is to build a main program by itself - that is - if the main program is expected to work perfectly.