POV-Ray : Newsgroups : povray.off-topic : using namespace : Re: using namespace Server Time
4 Sep 2024 03:20:27 EDT (-0400)
  Re: using namespace  
From: Orchid XP v8
Date: 2 Jun 2010 15:39:57
Message: <4c06b38d$1@news.povray.org>
Warp wrote:

>   Brevity only leads to obfuscation, ie. it causes the code to be harder
> to understand. Using unambiguous names and prefixes makes the code easier
> to read and understand.

Now who was it that once said comprehension = 1 / 2^precision ? ;-)

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)))

(Hell, I'm now even sure I got all the brackets right!) This tells you 
in exactly which order the sum operations happen in [which shouldn't 
matter in an associative algebra, but strictly floating-point arithmetic 
isn't associative].

The first version is much more terse, yet far more understandable. In 
general, I would suggest that there's no "simple" correlation between 
terseness/verbosity and comprehensibility.

It still makes me chuckle that Java has java.lang (what, you couldn't 
spare 5 extra characters?) and System.err (what, no 2 extra 
characters?), but also has

   java.lang.ArrayIndexOutOfBoundsException

Go count how many characters that is. (BoundsException would be just as 
good...)

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


Post a reply to this message

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