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