|Subject:||Re: [Axiom-developer] Heidegger, literate programming, and communication|
|Date:||Thu, 22 May 2014 16:00:28 +0000|
> Date: Thu, 22 May 2014 15:40:11 +0200
> From: address@hidden
> To: address@hidden
> CC: address@hidden; address@hidden
> Subject: Re: [Axiom-developer] Heidegger, literate programming, and communication
> On 05/22/2014 03:29 PM, Fabio S. wrote:
> >>> I can tell you I would rather maintain the four lines of C++ without
> >>> the largely useless commentary.
> >> That's a simple AXIOM program, but I'm sure one can easily translate it
> >> into any programming language.
> >> foo(a: Integer, b: Integer): Integer ==
> >> if a > 0 then
> >> if a > b then return foo(b,a)
> >> return foo(b-a,a))
> >> return b
> >> Question: Does the program have a bug?
> >> Ralf
> > Yes: there is an extra parenthesis in the fourth line... :)
> > Which, BTW, I discovered as soon as I pasted it in a file since it was
> > error-highlighted by the syntax highlighting in vim :))
> Well, you caught me, so I try again. ;-)
> And... the problem is be no means specific to AXIOM.
> foo(a: Integer, b: Integer): Integer ==
> if a > 0 then
> if a > b then return foo(b,a)
> return foo(b-a,a)
> return b
> Question: Does the program have a bug?
I think that your question is related to the fact that if we don't know the purpose of a function then we cannot know if there is a bug in the function.
And LP would explain the purpose of the function.
I am 100% in agreement with LP.
when I was teaching C C++ I was always repeating to my students that when you comment a line or section of code "don't tell me the this code copies the value in y to x (x=y) but tell me why that section of code is there."
I think that one of the posters is really missing the point of proper documentation, when he said that the comments are useless because he can always read the code. The comments are not there to explain what the code does on that low of a level, but why is it there and what is its overall purpose, and why I did it that way and not some other way.
Just my 2 cents worth.
PS I have many chunks of code that I wrote 20-30 years ago and I have no idea why and what the code was written for!!!! even after reading each line of the code!!!!
|[Prev in Thread]||Current Thread||[Next in Thread]|