You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Ian Boston <ie...@tfd.co.uk> on 2009/04/22 17:49:08 UTC

Code Style

Is there a code style guide for sling, or better still an eclipse  
config and import order.
It looks like standard java style but I am not sure about the space  
policy.
Ian

Re: Code Style

Posted by Ian Boston <ie...@tfd.co.uk>.
In Shindig we created a code style, although its made patching easier,  
it did generate discussion.
It was basically java standard, with some mods, eg 2 spaces rather  
than tabs, no trailing spaces on lines and a bunch of other things.
I can share these if you like (they are in the Shindig svn), but I am  
happy either way. I don't really want to start producing patches that  
are a pain to apply because of trivial formatting differences.
Ian

On 22 Apr 2009, at 16:55, Bertrand Delacretaz wrote:

> On Wed, Apr 22, 2009 at 5:49 PM, Ian Boston <ie...@tfd.co.uk> wrote:
>> Is there a code style guide for sling, or better still an eclipse  
>> config and
>> import order.
>> It looks like standard java style but I am not sure about the space  
>> policy...
>
> I'm not sure if we're sure either ;-)
>
> I use two spaces and no tabs for indents, and for the rest all the
> default Eclipse settings.
>
> -Bertrand


Re: Code Style

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Bertrand Delacretaz schrieb:
> On Wed, Apr 22, 2009 at 5:49 PM, Ian Boston <ie...@tfd.co.uk> wrote:
>> Is there a code style guide for sling, or better still an eclipse config and
>> import order.
>> It looks like standard java style but I am not sure about the space policy...
> 
> I'm not sure if we're sure either ;-)
> 
> I use two spaces and no tabs for indents, and for the rest all the
> default Eclipse settings.

two spaces ? Isn't the default 4 (which is also what Sun is recommending
IIRC). Anyway, I use 4 and most of the code seems to also be 4.

Regards
Felix

> 
> -Bertrand
> 

Re: Code Style

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Wed, Apr 22, 2009 at 5:49 PM, Ian Boston <ie...@tfd.co.uk> wrote:
> Is there a code style guide for sling, or better still an eclipse config and
> import order.
> It looks like standard java style but I am not sure about the space policy...

I'm not sure if we're sure either ;-)

I use two spaces and no tabs for indents, and for the rest all the
default Eclipse settings.

-Bertrand

Re: Code Style

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Ian,

Thanks for providing this. This is very much appreciated.

It is probably about time to start thinking and fighting about such a
thing as a coding convention ...

Ian Boston schrieb:
> For what it is worth, and I wont say I agree with all of it, but thats ok.
> 
> The shindig eclipse files are here
> http://svn.apache.org/repos/asf/incubator/shindig/trunk/etc/eclipse/
> but you probably wont want the import order as it reverses to allow
> overrides.
> 
> and there is a checkstyle config
> http://svn.apache.org/repos/asf/incubator/shindig/trunk/etc/checkstyle/checkstyle.xml
> 
> which is almost right.
> 
> There is a description of the thought process
> http://cwiki.apache.org/SHINDIGxSITE/java-style.html (mentions 4 and 2
> space indents)
> 
> 
> YM -will- V
> Ian
> 
> I hope I haven't opened up pandora's box :)

It may well be, but in the end, sooner or later this box would have been
opened upon us anyway ;-) So no worry.

To track this I created SLING-937 [1]. Feel free to add to this...

Regards
Felix

[1] https://issues.apache.org/jira/browse/SLING-937

> 
> On 22 Apr 2009, at 17:48, Felix Meschberger wrote:
> 
>> Hi Ian,
>>
>> Ian Boston schrieb:
>>> Is there a code style guide for sling, or better still an eclipse config
>>> and import order.
>>> It looks like standard java style but I am not sure about the space
>>> policy.
>>
>> Interesting topic which is as important as it is controverse.
>>
>> As Bertrand, I am basically using the default Eclipse Setup. What I
>> think is very important is the no-tab policy (I think we are pretty much
>> in agreement nowadays, that tabs are bad ;-) )
>>
>> Another thing is the formatting of comments and the line length. The
>> default in Eclipse is something like 80. In Apache Felix we have
>> something like 120.
>>
>> Sometimes I have the impression, that 120 would be better than 80 for
>> editing etc. But then I am hooked on my own personal vt100 legacy
>> thinking ;-)
>>
>> Regards
>> Felix
> 
> 

Re: Code Style

Posted by Ian Boston <ie...@tfd.co.uk>.
For what it is worth, and I wont say I agree with all of it, but thats  
ok.

The shindig eclipse files are here http://svn.apache.org/repos/asf/incubator/shindig/trunk/etc/eclipse/
but you probably wont want the import order as it reverses to allow  
overrides.

and there is a checkstyle config
http://svn.apache.org/repos/asf/incubator/shindig/trunk/etc/checkstyle/checkstyle.xml
which is almost right.

There is a description of the thought process
http://cwiki.apache.org/SHINDIGxSITE/java-style.html (mentions 4 and 2  
space indents)


YM -will- V
Ian

I hope I haven't opened up pandora's box :)

On 22 Apr 2009, at 17:48, Felix Meschberger wrote:

> Hi Ian,
>
> Ian Boston schrieb:
>> Is there a code style guide for sling, or better still an eclipse  
>> config
>> and import order.
>> It looks like standard java style but I am not sure about the space  
>> policy.
>
> Interesting topic which is as important as it is controverse.
>
> As Bertrand, I am basically using the default Eclipse Setup. What I
> think is very important is the no-tab policy (I think we are pretty  
> much
> in agreement nowadays, that tabs are bad ;-) )
>
> Another thing is the formatting of comments and the line length. The
> default in Eclipse is something like 80. In Apache Felix we have
> something like 120.
>
> Sometimes I have the impression, that 120 would be better than 80 for
> editing etc. But then I am hooked on my own personal vt100 legacy
> thinking ;-)
>
> Regards
> Felix


Re: Code Style

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Ian,

Ian Boston schrieb:
> Is there a code style guide for sling, or better still an eclipse config
> and import order.
> It looks like standard java style but I am not sure about the space policy.

Interesting topic which is as important as it is controverse.

As Bertrand, I am basically using the default Eclipse Setup. What I
think is very important is the no-tab policy (I think we are pretty much
in agreement nowadays, that tabs are bad ;-) )

Another thing is the formatting of comments and the line length. The
default in Eclipse is something like 80. In Apache Felix we have
something like 120.

Sometimes I have the impression, that 120 would be better than 80 for
editing etc. But then I am hooked on my own personal vt100 legacy
thinking ;-)

Regards
Felix