POV-Ray : Newsgroups : povray.off-topic : using namespace Server Time
4 Sep 2024 07:16:04 EDT (-0400)
  using namespace (Message 11 to 14 of 14)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: using namespace
Date: 3 Jun 2010 14:29:15
Message: <4c07f47b@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> I tend to think of, say,

>    sqrt(x^2 + y^2 + z^2)

> as being far easier to read than the strictly more precise equivilent

>    sqrt(sum(sum(power(x, 2), power(y, 2)), power(z, 2)))

  That's because operators are part of the language definition itself,
which every programmer of that language should know by heart. It's no
different than 'for', 'if' and 'int' being short. As they are reserved
keywords (and there's only a relatively limited amount of them), every
programmer who knows the language knows what they mean. Likewise with
the built-in operators.

  However. when you write a program and create your *own* unique types,
variables and function names, it's something nobody else has ever seen
before. It's something completely new to them. Thus the situation changes
completely: Now brevity becomes obfuscation, as the reader is seeing
something he has never seen before (because it has been created by you),
and has to figure out what it means.

  Thus naming conventions and things like clear library scopes help
understanding such a program much better, even if such conventions and
scopes mean that the names become a bit longer.

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v8
Subject: Re: using namespace
Date: 3 Jun 2010 15:00:01
Message: <4c07fbb1$1@news.povray.org>
Warp wrote:

>   That's because operators are part of the language definition itself,
> which every programmer of that language should know by heart.

>   However. when you write a program and create your *own* unique types,
> variables and function names, it's something nobody else has ever seen
> before. It's something completely new to them. Thus the situation changes
> completely: Now brevity becomes obfuscation.

My point is that sometimes having shorter names reveals the structure of 
what you're trying to do more clearly. (This is why mathematicians use a 
bazillion weird symbols for communication.)

But sure, I take your point that in the usual case, you want names that 
are going to make sense to people and be reasonably descripting without 
being too huge...

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


Post a reply to this message

From: Warp
Subject: Re: using namespace
Date: 3 Jun 2010 15:27:52
Message: <4c080237@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> (This is why mathematicians use a 
> bazillion weird symbols for communication.)

  Which works only when the symbols are well-established and known, not
unlike the keywords of a programming language.

  Try understanding mathematical formulas without knowing what the symbols
mean of where they might be defined...

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v8
Subject: Re: using namespace
Date: 3 Jun 2010 15:35:17
Message: <4c0803f5$1@news.povray.org>
Warp wrote:
> Orchid XP v8 <voi### [at] devnull> wrote:
>> (This is why mathematicians use a 
>> bazillion weird symbols for communication.)
> 
>   Which works only when the symbols are well-established and known, not
> unlike the keywords of a programming language.

I especially love the way mathematicians have developed seperate 
unrelated symbolisms for the same concepts. Or how occasionally the same 
symbols can mean radically different things depending on context.

(This isn't limited to symbols of course. How many meanings for the word 
"normal" can you find? There's the normal distribution, normal vectors, 
normed spaces...)

>   Try understanding mathematical formulas without knowing what the symbols
> mean of where they might be defined...

Been there, done that. It's not like there's a book somewhere which 
tells you what all this stuff means, after all. (And I was never taught 
mathematics.)

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


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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