POV-Ray : Newsgroups : povray.off-topic : code readability Server Time
7 Sep 2024 19:17:02 EDT (-0400)
  code readability (Message 41 to 50 of 73)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Re: code readability
Date: 27 Jun 2008 11:41:11
Message: <48650a17@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> I'd say that there is only a fairly weak correlation (positive or 
> negative) between compactness and readability.

>    x = 2*y*y*y - 3*a*b

  The context was really a multilined program source code, not a
mathematical formula, which your line really is.

  Mathematical formulae can often be written compactly because they
a) aren't really program code, and b) there's an established syntax
to write it compactly.

-- 
                                                          - Warp


Post a reply to this message

From: Invisible
Subject: Re: code readability
Date: 27 Jun 2008 11:50:16
Message: <48650c38$1@news.povray.org>
Warp wrote:

>   The context was really a multilined program source code, not a
> mathematical formula, which your line really is.
> 
>   Mathematical formulae can often be written compactly because they
> a) aren't really program code, and b) there's an established syntax
> to write it compactly.

Perhaps you forget, the very word "computer" means "device for 
performing mathematical calculations". ;-)

Having programmed with Haskell for a while now, I would contest the 
"programs aren't mathematics" assertion. Having played with mathematics 
for even longer, I would contest the "established syntax" assertion too! 
[Rather, there are several incompatible and variously ambiguous syntaxes 
for writing any particular mathematical construct...]

Regardless, I would assert that how "readable" something is depends on 
how well it maps to your underlying mental processes - which is rather 
independant of the compactness or otherwise of the code. ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Invisible
Subject: Re: code readability
Date: 27 Jun 2008 11:52:31
Message: <48650cbf$1@news.povray.org>
Mike Raiford wrote:

> Hey ... that looks familiar.
> 
> ... I think someone here used to write code exactly like that! 0.o

It's certainly what the compiler transforms your code into - this is 
what machines derived from the design of Turing expect. But it is not 
necessarily how humans think. ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Gail Shaw
Subject: Re: code readability
Date: 27 Jun 2008 12:49:28
Message: <48651a18@news.povray.org>
"Eero Ahonen" <aer### [at] removethiszbxtnetinvalid> wrote in message
news:4864edce$1@news.povray.org...
> Tim Nikias wrote:
> >
> > Heh, that reminds me... Some guy actually wrote code like this:
> >
>
> Somehow those variables remind me of what I've decided I'll do at work
> some day, when I'll have a place where it fits:
>
> if (!successful) {
> try_harder();
> }

My honours project at university had a line of code in it

while (!hellFrozenOver) {
...


Post a reply to this message

From: stbenge
Subject: Re: code readability
Date: 27 Jun 2008 13:26:06
Message: <486522ae@news.povray.org>
Mike Raiford wrote:
> stbenge wrote:
> 
>> If I worked for an organization, I would definitely change my style. 
>> Of course if I were programming for a living, I would probably go to 
>> school where they would teach me how to write code that people could 
>> decipher :)
> 
> Write code that others can decipher? Why would you do a thing like that? ;)
> 
> Everyone knows that if you code for a living, you code for job 
> security... you wouldn't want the janitor to take your job, would you? :D

Around here it is highly unlikely that a janitor would know how to 
program a computer, let alone operate one. This isn't to say people 
around here are stupid or anything. They are just generally 
computer-illiterate.

> (Of course, I'm joking .... it doesn't work well in a team environment 
> to code for job security)

A bit off-topic, but this reminds me of a guy I worked with at the 
travel nurse agency. The man worked in the 'computer engineering' 
section, along with the manager. His job, as far as I could tell, was to 
keep the computers running smoothly, and to archive lists of available 
or potentially available nurses. Now maybe I'm missing something here, 
but do you really need your own server for that kind of work? Can't you 
do those things with conventional computers and storage? Why did we even 
need a server when there were only about zero or three people making 
travel reservations at any given time? I wonder things these because the 
'computer engineer' seemed very self-important, an active preserver of 
personal job security. He even cast a contentious look one time when I 
helped a lady with her computer's resolution! Odd situation at any rate.

Sam


Post a reply to this message

From: Orchid XP v8
Subject: Re: code readability
Date: 27 Jun 2008 14:22:02
Message: <48652fca$1@news.povray.org>
Gail Shaw wrote:

> My honours project at university had a line of code in it
> 
> while (!hellFrozenOver) {
> ...

...you realise that when hell freezes over, your program is going to 
fail in an undefined way, right? (YHF bug?)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Gail Shaw
Subject: Re: code readability
Date: 27 Jun 2008 15:09:28
Message: <48653ae8@news.povray.org>
"Orchid XP v8" <voi### [at] devnull> wrote in message
news:48652fca$1@news.povray.org...
>
> ...you realise that when hell freezes over, your program is going to
> fail in an undefined way, right? (YHF bug?)
>

In the case of that piece of code, it would just not do anything on that
fateful day
The loop in question was the program's main activity loop (Distributed VR
system)


Post a reply to this message

From: andrel
Subject: Re: code readability
Date: 27 Jun 2008 16:09:25
Message: <4865492A.20706@hotmail.com>
Mike Raiford wrote:
> Warp wrote:
>> Gail Shaw <initialsurname@sentech sa dot com> wrote:
>>> Whereas I find the first far too spread out to be able to read easily
>>
>>   Compactness does not imply readability. On the contrary.
>>
> 
> Case in point:
> 
> n=(i<12&&j>=i)?(sqrt(z)*y+j):(y+j*i);
> 
> vs
> 
> if( i < 12 && j >= i )
> {
>     n = sqrt(z) * y + j;
> }
> else
> {
>     n = y + j * i;
> }
> 
> ;)
I'd like to see the specification that gave rise to that snipped of code. ;)


Post a reply to this message

From: Darren New
Subject: Re: code readability
Date: 27 Jun 2008 16:29:17
Message: <48654d9d$1@news.povray.org>
Invisible wrote:
> Perhaps you forget, the very word "computer" means "device for 
> performing mathematical calculations". ;-)

Actually, it means "person whose job it is to do the arithmetic." Only 
after they automated it did it refer to a machine. :-)

-- 
Darren New / San Diego, CA, USA (PST)
  Helpful housekeeping hints:
   Check your feather pillows for holes
    before putting them in the washing machine.


Post a reply to this message

From: andrel
Subject: Re: code readability
Date: 27 Jun 2008 16:29:47
Message: <48654DF0.3030004@hotmail.com>
Gail Shaw wrote:
> "Eero Ahonen" <aer### [at] removethiszbxtnetinvalid> wrote in message
> news:4864edce$1@news.povray.org...
>> Tim Nikias wrote:
>>> Heh, that reminds me... Some guy actually wrote code like this:
>>>
>> Somehow those variables remind me of what I've decided I'll do at work
>> some day, when I'll have a place where it fits:
>>
>> if (!successful) {
>> try_harder();
>> }
> 
> My honours project at university had a line of code in it
> 
> while (!hellFrozenOver) {
> ...
> 
> 
was that before or after Lordi won?


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.