Earlier quoted context omitted.
If I grasp that right, it says that if something is provable mathematically, then you can write a program for it with an equal meaning. I still don't see how that prevents user error. My question is then how do you mathematically prove intent? Also, how far should "sufficiently advanced" be? We already have a tool for that in the forms of unit tests and types does help if the subject is abstract enough.
You need more than an advanced type system. You need a declarative constraint solving and proof system. Instead of telling the compiler how to perform a task, you would declare the assumptions and the desired relationships and then, with the help of the proof system, determine what implementation fullfills exactly those constraints.
The Power of Ten – Rules for Developing Safety Critical Code
111–120 of 155 posts
Re: The Power of Ten – Rules for Developing Safety Critical Code
#112Earlier quoted context omitted.
It's not "disregarded", it's eclipsed by a need to ship often and ship a lot. There is a tendency to overstate amount of problems that come from bugs because they are painful to debug. Therefore, somewhat experienced programmers are often too defensive and suspect to paralysis by analysis (of which uber-complicated and rigid typing is a sort). Even if some advanced typing system will save a few days of debugging afte…
> paralysis by analysis (of which uber-complicated and rigid typing is a sort). How "paralysis by analysis" has anything to do with typing? And how is typing uber-complicated to begin with? This is ultra basic logic... And why exactly you you think dynamic langages are exempt of typing? How does all of that has anything to do with a competitor shipping "buggy RoR-based systems a few months earlier"? You can do all ki…
Lots of people do.
Yes, they often turn out dead, or missing limbs. But it's a fact that they do, to the point that industries have to police and punish people that don't use safety gear.
Developers have a similar mindset, just way less dangerous.
Re: The Power of Ten – Rules for Developing Safety Critical Code
#113Earlier quoted context omitted.
Sadly quality is highly disregarded in our field. I dream of the day when not making use of contracts, static analysis and type based programming is seen as quality smell and not something that only a few are allowed to make use of.
It's not "disregarded", it's eclipsed by a need to ship often and ship a lot. There is a tendency to overstate amount of problems that come from bugs because they are painful to debug. Therefore, somewhat experienced programmers are often too defensive and suspect to paralysis by analysis (of which uber-complicated and rigid typing is a sort). Even if some advanced typing system will save a few days of debugging afte…
Re: The Power of Ten – Rules for Developing Safety Critical Code
#114Regarding Rule 4 - No Large Function - I think John Carmack had a pretty good explanation on why that's not really a good thing: http://number-none.com/blow/john_carmack_on_inlined_code.htm...
>fighter) went a step further. It disallowed both subroutine calls and
>backward branches, except for the one at the bottom of the main loop.
>Control flow went forward only. Sometimes one piece of code had to leave
>a note for a later piece telling it what to do, but this worked out well
>for testing: all data was allocated statically, and monitoring those
>variables gave a clear picture of most everything the software was doing.
>The software did only the bare essentials, and of course, they were
>serious about thorough ground testing.
>No bug has ever been found in the "released for flight" versions of that code.
I was pretty excited to learn more about that style, and then I came across...
https://www.flightglobal.com/FlightPDFArchive/1989/1989%20-%...
...but I'd still like to know more about this style of programming, and languages that facilitate programming in that manner.
Re: The Power of Ten – Rules for Developing Safety Critical Code
#115Earlier quoted context omitted.
I doubt that statement can be true in any programming language. Bugs come in many shapes and a functional language can prevent a fraction of it. You can have logic errors, misunderstood requirements, wrong database queries etc, the list is pretty much infinite.
The https://en.wikipedia.org/wiki/Curry–Howard_correspondence says there is a correspondence between any logical statement and a type in a sufficiently advanced type system. So yes, there are languages aimed at eliminating logic errors, and Haskell goes pretty far(though its type system isn't quite advanced enough).
Re: The Power of Ten – Rules for Developing Safety Critical Code
#116If we're talking about high reliability code, one thing claimed about Haskell, is "if it compiles, it has no bugs". How close is it to the truth ? And how close are we to having that kind of capability for real-time programming(even assuming we're willing to forsake protability, community, and maximum efficiency to some extent ) ?
I imagine you will find this paper interesting "Haskell vs. Ada vs. C++ vs. Awk vs. ... An Experiment in Software Prototyping Productivity" http://haskell.cs.yale.edu/?post_type=publication&p=366
Re: The Power of Ten – Rules for Developing Safety Critical Code
#117Rule 0: don't write safety-critical code in C.
So if you write safety critical code in Haskell, say, you won't have a large number of the holes that C gives you. But for safety critical systems, their rules say that you can't write code that has even the possibility of falling into those holes. That makes C much safer. That leaves you with a safer C, plus tooling, vs. Haskell (or whatever your choice is) without the tooling.
So, snark aside, what is your actual alternative that you recommend?
Re: The Power of Ten – Rules for Developing Safety Critical Code
#118Regarding Rule 4 - No Large Function - I think John Carmack had a pretty good explanation on why that's not really a good thing: http://number-none.com/blow/john_carmack_on_inlined_code.htm...
Really long functions that have very low complexity (very few nested control structures, ideally none) and do not contain any loops that aren't trivial are easy to reason with. They are essentially the one case I'm familiar with where longer is not worse after a point.
Re: The Power of Ten – Rules for Developing Safety Critical Code
#119Regarding Rule 4 - No Large Function - I think John Carmack had a pretty good explanation on why that's not really a good thing: http://number-none.com/blow/john_carmack_on_inlined_code.htm...
>The fly-by-wire flight software for the Saab Gripen (a lightweight >fighter) went a step further. It disallowed both subroutine calls and >backward branches, except for the one at the bottom of the main loop. >Control flow went forward only. Sometimes one piece of code had to leave >a note for a later piece telling it what to do, but this worked out well >for testing: all data was allocated statically, and monitorin…
Which is to say, a serious problem, but if we take "bug" to mean a difference between designed function and realized function, not a "bug", and therefore not something which should tarnish the record of the coding style to which the bug-free nature of the Grippen software is attributed. The problem seems to have been at a different level than coding.
Re: The Power of Ten – Rules for Developing Safety Critical Code
#120Earlier quoted context omitted.
I imagine you will find this paper interesting "Haskell vs. Ada vs. C++ vs. Awk vs. ... An Experiment in Software Prototyping Productivity" http://haskell.cs.yale.edu/?post_type=publication&p=366
I would imagine, though, that "prototyping" and "safety critical" are on opposite ends of the spectrum...
Hence the way it was written.