Question(s)

Thomas Passin list1 at tompassin.net
Tue Oct 24 18:50:32 EDT 2023


On 10/24/2023 8:22 AM, o1bigtenor via Python-list wrote:
> Greetings
> 
> (Sorry for a nebulous subject but dunno how to have a short title for
> a complex question.)
> 
> I have been using computers for a long time but am only beginning my
> foray into the
> galaxy of programming. Have done little to this point besides
> collection of information
> on sensors and working on the logic of what I wish to accomplish. Have
> been reading code that accompanies other's projects in the process of
> self development.
> 
> Is there a way to verify that a program is going to do what it is
> supposed to do even
> before all the hardware has been assembled and installed and tested?
> 
> (Many years ago I remember an article (if not an issue) in Byte magazine about
> mathematically proven constructs a.k.a. programs - - - this idea is
> what I'm pursuing.
> The concept is that in non-trivial programs there are plenty of places where a
> poorly placed symbol or lack of a character will result in at best an inaccurate
> result and at worst - - - no result. This is the kind of thing
> (correct code) that I'm
> hoping to accomplish - - - to rephrase the question - - - how do I
> test for that?)
> 
> TIA

By now you have read many responses that basically say that you cannot 
prove that a given program has no errors, even apart from the hardware 
question.  Even if it could be done, the kind of specification that you 
would need would in itself be difficult to create, read, and understand, 
and would be subject to bugs itself.

Something less ambitious than a full proof of correctness of an 
arbitrary program can sometimes be achieved.  The programming team for 
the Apollo moon mission developed a system which, if you would write 
your requirements in a certain way, could generate correct C code for them.

You won't be doing that.

Here I want to point out something else.  You say you are just getting 
into programming.  You are going to be making many mistakes and errors, 
and there will be many things about programming you won't understand 
until you get some good solid experience.  That's not anything to do 
with you personally, that's just how it will play out.

So be prepared to learn from your mistakes and bugs.  They are how you 
learn the nuts and bolts of the business of programming.



More information about the Python-list mailing list