I always worry about establishing code formatting guides because in my
experience it often devolves into unproductive arguments.

Scanning through the geronimo guides the only things I do not
particularly like are:

1. I prefer 2 spaces for indent to 4. It gives you more line length
for actual code to fix.
2. I prefer methods and classes to put the curly brace on a new line.
It helps me to identify where the method starts.

In my view the primary rule for any code formatting rules is that they
be consistent within a file. So if a file uses 4 spaces for indent,
you use 4 (or you change it to 2 consistently in the file). I also
think you should only change the code formatting if you are a
significant contributor to the file.

I defiantly agree that tabs should be banned in any source file :)

Alasdair

On 16 February 2010 10:25, Jeremy Hughes <[email protected]> wrote:
> On 16 February 2010 10:07, Guillaume Nodet <[email protected]> wrote:
>> I'd like aries to try using a single coding standards.
>> Specifically, i'd like us to agree on indentation rules (the code uses
>> 2 or 4 spaces in different places).
>> I'd like to propose the geronimo coding standards which is in use in a
>> lot of projects at apache.
>> See http://geronimo.apache.org/coding-standards.html
>
> I had a quick look. I agree to no tabs and prefer 2 spaces to 4. I
> also think this needs to apply to xml.
>
> Whatever the convention is, we should be able to codify it in an
> Eclipse code formatter profile (and equivalents for other IDE). If the
> formatting convention requires manual steps to apply - i.e. anything
> more than: select-all then ctrl-shift-f to format, then I don't think
> it will be applied consistently.
>
>>
>> Btw, I really don't think we should enforce those at all cost using
>> maven plugins or such,
>
> I didn't know there was one! This actually sounds like a perfectly
> reasonable thing to do - like removing compile warnings, and fixing or
> filtering issues findbugs finds. So on the face of it I'm actually +1
> for this.
>
>> but agreeing on
>> those would allow to reformat the code once and not go back and forth
>> between different standards.
> +1 !!
>
> Cheers,
> Jeremy
>



-- 
Alasdair Nottingham
[email protected]

Reply via email to