On Thu, 2016-07-07 at 15:45 +0100, Clive Page wrote:
> My guess, however, is that no more than 10% of my mistakes involve
> using
> the wrong units, and when they occur they are always very evident, as
> the results are typically out by a factor of some large number like
> 86400, which even astronomers tend to notice, so they are easy to
> diagnose and fix. I don't expect that using a comprehensive units
> system such as yours would actually reduce my debugging time by more
> than a one or two percent, nor would it simplify the code.
>
> I take your point that such a system might have prevented the loss of
> the Mars Climate Orbiter which was most unfortunate but perhaps
> almost
> unique; I haven't seen any other evidence that mistakes in units
> generally get through the most basic testing procedures that all
> software developers use. Because these mistakes cause effects which
> are
> so hard to miss, they almost never escape into production code, in my
> experience.
A factor of 4.4 ought to be obvious, but if it affects a small part of a
code, and ends up making a difference of 67/35,000,000 it's not really
obvious.
I spend about 6-8% of my time chasing subtle errors related to units,
that might be obvious where they occur but are masked by the small
magnitude of the error they introduce compared to the big picture. If
we had more fine-grained unit testing it would be helpful, but we have
only two developers responsible for 1/3 million lines of code. Help
from the language and processor can go a long way to reduce labor cost,
or mitigate the need to spend more on labor.
Unit testing probably wouldn't have caught the error that doomed Mars
Climate orbiter, since the error was in the input, not in the code.
|