Re: maths for programming C++
- From: Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx>
- Date: Tue, 25 Jul 2006 03:04:22 GMT
Robbie Hatley wrote:
"Logan Shaw" <lshaw-usenet@xxxxxxxxxxxxx> wrote:Richard Heathfield wrote:August Karlstrom said:
And how would you define a great programmer?
Someone who values readability over correctness, and correctness over
everything else.
Um, I'm really hoping that contains a typo. Readability over correctness?!?
To paraphrase someone else, if correctness isn't a requirement, then I'll
just write
int main ()
{
}
and be done with it.
I'm afraid I have to agree with Mr. Heathfield on that. Buggy-
but-readable programs can easily be fixed.
Not necessarily. If fixing them makes them even slightly less
readable, then it's not allowed under the rules, because readability
is valued more than correctness.
Let me give a concrete example. Here's a program:
#include <stdio.h>
int main ()
{
size_t x = 8;
printf ("%d\n", x);
}
Now, here's a correct program (or at least one with fewer bugs):
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
size_t x = 8;
printf ("%lu\n", (unsigned long) x);
return 0;
}
Which one is more readable? To me, it's the first. There's less
clutter, and it's readily apparent what the programmer intended.
So, under the rules of readability over correctness, the second
program isn't allowed.
- Logan
.
- Follow-Ups:
- Re: maths for programming C++
- From: Richard Heathfield
- Re: maths for programming C++
- References:
- Re: maths for programming C++
- From: August Karlstrom
- Re: maths for programming C++
- From: Richard Heathfield
- Re: maths for programming C++
- From: Logan Shaw
- Re: maths for programming C++
- From: Robbie Hatley
- Re: maths for programming C++
- Prev by Date: Re: Simle Hash for Invoice Numbers?
- Next by Date: Re: Simple question, err... I think
- Previous by thread: Re: maths for programming C++
- Next by thread: Re: maths for programming C++
- Index(es):
Relevant Pages
|