|
 |
Orchid XP v8 <voi### [at] dev null> 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
|
 |
|
 |
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
|
 |
|
 |
Warp wrote:
> Orchid XP v8 <voi### [at] dev null> 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
|
 |