News for hackers. Stuff that matters.
Re:NASA has a list of 10 rules for software development by Swizec on Saturday February 15, 2025 @05:08PM (#43062867)
Is a reference to this famous incident of a mars lander slamming into mars due to mismatched units.

https://everydayastronaut.com/mars-climate-orbiter/

Re:NASA has a list of 10 rules for software development by kanbankaren on Saturday February 15, 2025 @05:45PM (#43063217)
Not sure whether they used a value pattern.

typedef struct { float value; } meter;

typedef struct { float value; } feet;

Using strong typing, you can avoid passing values in wrong units.

Re:NASA has a list of 10 rules for software development by einpoklum on Saturday February 15, 2025 @06:06PM (#43063374)
In C++, there are a few very nice libraries for computation with units, e.g.:

https://github.com/mpusz/mp-units

which does all sorts of checking, allows arithmetic with proper accounting for units and so on. But yes, the basic notion is wrapping things in structs which can't be simply assigned to each other.

Re:NASA has a list of 10 rules for software development by dgoodell on Sunday February 16, 2025 @08:09AM (#43067699)
The mars probe unit problem was mismatched between different software programs. One was telemetry reported by the spacecraft to the ground, the other was software on the ground that used this telemetry to perform calculations that reported the results with the incorrect units.

Maybe the answer is that strong typing should somehow continue outside of the individual programs and be embedded in file formats as well?

Re:NASA has a list of 10 rules for software development by kanbankaren on Sunday February 16, 2025 @11:47AM (#43069411)
Yes. Any message exchanges should have type encoded like in ASN.1, but not sure whether NASA used such a format.