POV-Ray : Newsgroups : povray.off-topic : using namespace : Re: using namespace Server Time
4 Sep 2024 09:17:47 EDT (-0400)
  Re: using namespace  
From: Warp
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

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