Re: Java Code Style Template
1) +1 2) -1 - We use git and git does not like trailing whitespace. 3) I don't have an opinion here. Deron On Thu, Jun 15, 2017 at 10:59 AM, Nakul Jindal wrote: > 1) +1 > 2) -1 --- i agree with Mike, also it seems like there is more setup needed > in various editors to preserve trailing whitespace than to get rid of it. > 3) Soft -1 --- We can try to remain consistent with the java spec. Since > Point 1 (switch indentation) is followed from the java spec, maybe we could > adhere to it completely. But, I have no strong opinion. > > -Nakul > > On Thu, Jun 15, 2017 at 10:51 AM, wrote: > > > 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 > > 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 > > > -- Deron Eriksson Spark Technology Center http://www.spark.tc/
Re: Java Code Style Template
1) +1 2) -1 --- i agree with Mike, also it seems like there is more setup needed in various editors to preserve trailing whitespace than to get rid of it. 3) Soft -1 --- We can try to remain consistent with the java spec. Since Point 1 (switch indentation) is followed from the java spec, maybe we could adhere to it completely. But, I have no strong opinion. -Nakul On Thu, Jun 15, 2017 at 10:51 AM, wrote: > 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 > 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 >
Re: Java Code Style Template
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 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