Before you debug the code, check the units
🔖A small habit that prevents large engineering mistakes.
Key Takeaways
- Write the units down
- Convert at the boundary
- Test a known case
Write the units down
A calculation can execute perfectly and still be wrong. Record the units of every input before building a model.
Convert at the boundary
Convert incoming measurements into one consistent unit system. For example, divide millimetres by 1,000 before using them as metres.
Test a known case
Choose a simple case with a hand-calculated answer, then compare your program output.