=?UTF-8?B?QXJuZSBWYWpow7hq?=<arne@vajhoej.dk> writes:
Let me quote Java Coding Convention:
<quote>
10.5.1 Parentheses
It is generally a good idea to use parentheses liberally in expressions
involving mixed operators to avoid operator precedence problems. Even if
the operator precedence seems clear to you, it might not be to
others-you shouldn't assume that other programmers know precedence as
well as you do.
</quote>
The Java Code Conventions were last modified in 1999.
They also contain other advice that obviously is bad:
?Methods should be verbs (...) runFast();?
http://www.oracle.com/technetwork/java/codeconventions-135099.html
First, ?run fast? is not a verb. ?run? is a verb. ?run fast?
is a verbal phrase.
Next, obviously this advice was not followed even by Sun
engineers, and for good reasons, we have ?main? and ?sin?
- not ?run? and (I can't find any verb for a method that is
used to write expressions denotating the sine of a value).
The correct rule in this regard is given by Rob Pike:
?Procedure names should reflect what they do;
function names should reflect what they return.?
http://www.lysator.liu.se/c/pikestyle.html
This, ?sin?, correctly, is a noun, because it names what
is returned. ?print? correctly is a verb, because it names
what it does.
be compliant with the rule.
makes more sense.
"sin" makes more sense than "calcSin". :-)