POV-Ray : Newsgroups : povray.off-topic : An interesting read : Re: An interesting read Server Time
28 Jul 2024 20:19:43 EDT (-0400)
  Re: An interesting read  
From: clipka
Date: 15 Jan 2014 08:37:58
Message: <52d68f36$1@news.povray.org>
Am 15.01.2014 10:57, schrieb scott:
>> One
>> aspect is about visual perception: In your version, the reader has to
>> first figure out what is code and what is explanation, whereas in Andy's
>> version it's one and the same.
>
> Except Andy's version doesn't actually have any code, it's hidden away
> in a separate method (which you would either need to search or scroll to).

... if I'd really bother. Which is exactly the point: Usually I won't.

> Especially with comments being highlighted in most code editors, I
> personally find this much more useful:
>
> prime = array[0]; // get next prime
>
> thank this:
>
> prime = GetNextPrime(array);

Whoever invented code highlighting does indeed deserve a medal or two.

Typically though, comments are actually "lowlighted"; while it does make 
it easier to distinguish between code and comments, it still draws the 
attention to the code rather than the comments.


> What seems to be being advocated is to replace source code like this:
>
> <trivial code> <comment>
>
> with this:
>
> <call a function with "comment" name>
> ...
> <function definition of "comment">
>   <trivial code>
> </>
>
> Sorry I don't see the benefit.

As I said, visual perception is only one aspect.

I also don't think the single-line case is typical in practice.

Then there's also the aspect that if you move into functions some 
multi-line code sections operating at array access level, it can be 
argued that the remaining single-line code sections operating at array 
access level should be moved into functions as well, in order to get a 
homogenous level of abstraction.

And last not least, I'm not really advocating the above - I just present 
arguments in favor (which probably sounds/reads just the same, but 
actually isn't). I prefer to leave it up to the reader to decide for 
themselves.


Post a reply to this message

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