POV-Ray : Newsgroups : povray.off-topic : code readability Server Time
7 Sep 2024 17:13:41 EDT (-0400)
  code readability (Message 31 to 40 of 73)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Eero Ahonen
Subject: Re: code readability
Date: 27 Jun 2008 09:40:30
Message: <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();
}

> Regards,
> Tim


-- 
Eero "Aero" Ahonen
    http://www.zbxt.net
       aer### [at] removethiszbxtnetinvalid


Post a reply to this message

From: Mike the Elder
Subject: Re: code readability
Date: 27 Jun 2008 09:45:00
Message: <web.4864ee92b4d9c1875a8888d90@news.povray.org>
Warp <war### [at] tagpovrayorg> 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.
>
> --
>                                                           - Warp

IBELIEV
ETHATIN
THISCAS
EIAMCOM
PELLEDT
OAGREEW
ITHYOU!


BEST
REGA
RDSM
IKEC


Post a reply to this message

From: Invisible
Subject: Re: code readability
Date: 27 Jun 2008 09:47:37
Message: <4864ef79$1@news.povray.org>
Warp wrote:

>   Compactness does not imply readability. On the contrary.

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

is much more readable than

   t1 = y*y
   t2 = y*t1
   t3 = 2*t2
   t4 = a*b
   t5 = 3*t4
   t6 = t3-t5

despite being much more compact. Counter-examples in the opposite 
direction are not hard to find either.

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


Post a reply to this message

From: Mike Raiford
Subject: Re: code readability
Date: 27 Jun 2008 10:29:01
Message: <4864f92d@news.povray.org>
Invisible wrote:

> is much more readable than
> 
>   t1 = y*y
>   t2 = y*t1
>   t3 = 2*t2
>   t4 = a*b
>   t5 = 3*t4
>   t6 = t3-t5
> 
> despite being much more compact. Counter-examples in the opposite 
> direction are not hard to find either.

Hey ... that looks familiar.

... I think someone here used to write code exactly like that! 0.o


Post a reply to this message

From: Mike Raiford
Subject: Re: code readability
Date: 27 Jun 2008 10:29:35
Message: <4864f94f$1@news.povray.org>
Stephen wrote:
> On Fri, 27 Jun 2008 01:26:58 +0300, Eero Ahonen
> <aer### [at] removethiszbxtnetinvalid> wrote:
> 
>> Warp wrote:
>>>   I disagree.
>>>
>> Good, 'cause you're wrong.
> 
> I can't help but agree with you.

I disagree.

Everyone's wrong!


Post a reply to this message

From: Mike Raiford
Subject: Re: code readability
Date: 27 Jun 2008 10:31:41
Message: <4864f9cd$1@news.povray.org>
Eero Ahonen wrote:
> 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();
> }
> 
>> Regards,
>> Tim
> 
> 

try
{
    AcheiveYourGoals();
}
catch(DidntSucceedException ex)
{
   TryAgain();
}

:p


Post a reply to this message

From: Mike Raiford
Subject: Re: code readability
Date: 27 Jun 2008 10:33:58
Message: <4864fa56$1@news.povray.org>
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

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


Post a reply to this message

From: Mike Raiford
Subject: Re: code readability
Date: 27 Jun 2008 10:38:20
Message: <4864fb5c$1@news.povray.org>
Halbert wrote:
> How about Microsoft's engineers starting the whole Hungarian Notation 
> convention with Windows programing. (like lpstrFilePath or iRecursion, etc.) 
> There seems to be no set standard to it. While the intention is good,  a 
> beginner may have wonder why some variables have names like lpszDemung or 
> lpfnCBack.

There seems to be two standards, one which describes type: lpszString 
and one that defines function (sort of): instead of iOptions, it's fOptions.

You don't know how many times I've looked at a function signature, and 
seen fSomething on something that should receive bits and wondered why 
the hell they want a float, only to look a bit to the left and see that 
it is indeed an integer.


Post a reply to this message

From: Invisible
Subject: Re: code readability
Date: 27 Jun 2008 10:39:56
Message: <4864fbbc$1@news.povray.org>
Mike Raiford wrote:

> try
> {
>    AcheiveYourGoals();
> }
> catch(DidntSucceedException ex)
> {
>   TryAgain();
> }


try
{
   AchieveYourGoals();
}
catch (Failure e)
{
   CallAirStrike();
}

// With appologies for Murphy...

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


Post a reply to this message

From: Eero Ahonen
Subject: Re: code readability
Date: 27 Jun 2008 11:34:04
Message: <4865086c$1@news.povray.org>
Mike Raiford wrote:
> 
> try
> {
>    AcheiveYourGoals();
> }
> catch(DidntSucceedException ex)
> {
>   TryAgain();
> }
> 
> :p

Would be great, too :). The thing about my code is that at work we have 
this department-wide habit that if someone says "this doesn't work" or 
"I can't do this" oslt, the first answer is usually "try harder".

-- 
Eero "Aero" Ahonen
    http://www.zbxt.net
       aer### [at] removethiszbxtnetinvalid


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.