systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Boehm <mboe...@googlemail.com>
Subject Java Code Style Template
Date Sun, 11 Jun 2017 05:39:50 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message