You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by David Bosschaert <da...@gmail.com> on 2015/08/05 00:26:54 UTC

Re: Source formatting rules for Aries?

What might be interesting is to look at what is proposed for OpenJDK.
Here a new style guide is being worked on:
http://mail.openjdk.java.net/pipermail/discuss/2015-August/003766.html

http://cr.openjdk.java.net/~alundblad/styleguide/

Personally I think it looks like what most people would be expecting...

Cheers,

David

On 9 July 2015 at 10:22, Christian Schneider <ch...@die-schneider.net> wrote:
> On 09.07.2015 11:39, David Bosschaert wrote:
>>
>> I like the idea of having code formatting rules too. Just a couple of
>> thoughts from my side:
>> * I hate tabs too
>
> I think we all agree on spaces over tabs and probably also to use 4 spaces
> per indent level.
>>
>> * Line length should be at least 128 or more
>
> ~130 sounds like a good length to me too.
>>
>> * I dislike curlies on a separate line (like is done in some projects)
>> as it wastes space IMHO. I prefer them at the end of the current line
>> (open) and start of the line (close). This is pretty much the way it
>> is done in general in Aries right now.
>
> I also used to like the curlies on the same line to save vertical space.
> Unfortunately
> it does not work well with the better indenting for method parameters.
>
> If you put the method parameters in a new line and indent them then they are
> at the same
> level like the method calls inside myMethod. So it is too easy to confuse
> parameters and method calls.
>
> public void myMethod(
> String first, String second) {
>     someCode(
>         first, second);
> }
>
> If you do the curlie brace in a new line it separates the parameters from
> the method calls inside:
>
> public void myMethod(
>     String first, String second)
> {
>     someCode(
>         first, second);
> }
> So I think the curly braces rule is connected to the indent style for
> parameters.
> If we indent Parameters like in CXF then the curly braces on the same line
> are good.
> If we indent Parameters one level in a new line then curly braces should
> also be in a new line.
>
> I prefer the second style but can also live with the cxf one.
>
>
> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>