Back to feed
Dev.to
Dev.to
6/17/2026
The worked example that disagreed with its own calculator

The worked example that disagreed with its own calculator

Short summary

A developer found a $5,500 discrepancy between his cost calculator and written examples—same inputs, different outputs. Root cause: identical values lived in four places with different assumptions. Solution: Source-first principle—generate all derived values from a single function at build time, never hand-copy. Add visible provenance (source, date, review-by) so stale data becomes impossible to hide.

  • Manual data duplication breeds drift: $5,500 gap between calculator and examples revealed unwritten assumptions scattered across code, prose, and tables
  • Source-first principle: generate all derived values from one calculate() function at build time, not hand-copy them
  • Pair with data provenance metadata (source, date, review-by window) to force transparency and prevent undetected staleness

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more