Painfully true. There are techniques for writing better software. They work. They take longer and cost more. They are not widely used outside aerospace.
Painfully true. There are techniques for writing better software. They work. They take longer and cost more. They are not widely used outside aerospace.
In general, the answer typically involves formal specification and formal methods that check the code against these specifications, combined with testing and coding standards that result in analysable code.
More references:
https://www.cs.umd.edu/~mvz/cmsc630/clarke96formal.pdf
http://research.microsoft.com/en-us/um/people/lamport/tla/fo...
There's also various specification languages for multithreaded behaviour, which allows you to analyse your programs behaviour using software tools, for example SPIN[0].
For example, with MISRA it may be C, but feels like Ada.
Or Spark similarly for Ada
It's unfortunate, and it's sad to say I'm often part of it at some level (but I fight it dammit!).