Kathey Marsden wrote:
Dan, what is your quality concern with the Sun convention and how
might we best mitigate it?
I talked with Dan briefly about this yesterday. His concern was that
section 6.3 indicates that declaration placement should be at the
beginning of block. It says: "Don't wait to declare variables until
their first use." The concern is that this convention forces
artificial expansion of scope which can be dangerous, especially if
initialization, included with the declaration is for primitives. Knut
also pointed out recently that it does not make the code clearer [1].
I think that we can safely amend our convention to exclude this part of
the convention for 2 reasons.
1) I agree it is a legitimate quality risk and we have enough of those.
2) I think there is no way, even if there was agreement that the
beginning of the block was good and all could agree that reformatting
was good, that our existing code would ever be adjusted.
So here is my suggested wording for the DerbyContributorChecklist [2] for
Coding Convention (changed from "Coding standard" to make it sound less
militant)
Derby uses the "Code Conventions for the Java Programming Language" [3]
with space indentation (no tabs). One variation is that Derby does not
discourage deferring variable declaration to the first use. Lines
should be limited to 80 characters and @author tags should not be used
at all. Note: There is a great deal of existing code that does not
match this convention. Changes to existing code should match the
surrounding code for readability, matching tabs or spaces as appropriate
(see Tabs) . Patches should not have white space diffs. Code and diffs
should be readable in context.
Any strong objections to this shed color or ideas for improved
wording? Do we need a formal vote?
Kathey
[1] Knut's comments :
https://issues.apache.org/jira/browse/DERBY-1320#action_12423783
[2] DerbyContributorChecklist :
http://wiki.apache.org/db-derby/DerbyContributorChecklist
[3] Code Conventions for the Java Programming Language :
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html