Thanks for bringing this up, Matthias.  Here are my thoughts on those items:

1) +1
2) -1 -- I would prefer no extraneous whitespace at the end of any lines.
3) I don't have a strong opinion here.  I would suggest also including thoughts 
on the positioning of curly braces, i.e. on the same line (Java-style) versus 
on a new line (C-style).

Looking forward to thoughts from others as well.

--

Mike Dusenberry
GitHub: github.com/dusenberrymw
LinkedIn: linkedin.com/in/mikedusenberry

Sent from my iPhone.


> On Jun 10, 2017, at 10:39 PM, Matthias Boehm <mboe...@googlemail.com> wrote:
> 
> thanks Deron for preparing the initial version of our code style templates
> - these templates are certainly very useful for consistency. I finally got
> a chance to have a look and would like to propose some minor changes for
> the Java code style.
> 
> 1) Switch statement indentation: Right now, the template does not use
> indentation for case labels in switch statements. However, in our current
> code base, we use indentation for almost all switch statements because it
> is much easier to read. I know there is some controversy about this but
> even the Java spec uses indentation for switch statements [1].
> 
> 2) Empty line indentation: We also generally indent empty lines to align
> with the previous line, which makes the code faster to navigate and edit.
> 
> 3) White spaces / new lines around braces: I would prefer to use (a) white
> spaces after opening and before closing parentheses, but not before opening
> parentheses (in for, while, if, switch, etc), and (b) insert newlines
> before keywords such else and catch.
> 
> Finally, we also need to discuss if we should auto format the existing
> code. In my opinion, the auto formatted code usually looks quite poorly.
> Hence, I would restrict any auto formatting to files which formatting is
> really off (e.g., files with space indentation).
> 
> Regards,
> Matthias
> 
> [1] http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.11

Reply via email to