You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by David Caruana <da...@alfresco.com> on 2009/08/13 17:40:26 UTC

Coding conventions

Quick question...  are there any Apache guidelines for coding  
conventions? I can find plenty of project specific guides.

I'll match the code already in Chemistry - I'm just intrigued as to  
whether a document exists.

Thanks,
Dave

Re: Coding conventions

Posted by David Caruana <da...@alfresco.com>.
Thanks Jukka.

On 13 Aug 2009, at 16:51, Jukka Zitting wrote:

> Hi,
>
> On Thu, Aug 13, 2009 at 5:40 PM, David
> Caruana<da...@alfresco.com> wrote:
>> Quick question...  are there any Apache guidelines for coding  
>> conventions?
>
> No, each project sets their own coding conventions.
>
> Most of the Java projects at Apache tend to stick pretty close to the
> standard Java conventions which makes it easier to migrate code
> between projects, but that's no fixed rule.
>
> Another pretty widely adopted convention is to use spaces instead of
> tabs for indentation. That makes cooperation easier as everyone will
> see the code indented in the same way regardless of their tab
> settings.
>
> BR,
>
> Jukka Zitting


Re: Coding conventions

Posted by Florent Guillaume <fg...@nuxeo.com>.
On 13 Aug 2009, at 17:51, Jukka Zitting wrote:
> On Thu, Aug 13, 2009 at 5:40 PM, David Caruana<david.caruana@alfresco.com 
> > wrote:
>> Quick question...  are there any Apache guidelines for coding  
>> conventions?
>
> No, each project sets their own coding conventions.
>
> Most of the Java projects at Apache tend to stick pretty close to the
> standard Java conventions which makes it easier to migrate code
> between projects, but that's no fixed rule.
>
> Another pretty widely adopted convention is to use spaces instead of
> tabs for indentation. That makes cooperation easier as everyone will
> see the code indented in the same way regardless of their tab
> settings.


The coding conventions I've used in Chemistry are basically those we  
use at Nuxeo, which are fairly standard. Some highlights:
- as Jukka mentioned, no tabs whatsoever (including in XML files)
- no spaces at end of lines (Eclipse has a Save Action for that for  
Java files, and AnyEdit can do it for XML)
- indent 4 chars for Java, 2 chars for XML
- maximum line width 80 chars, wrap before operators

For reference our Eclipse formatter config is at (direct download):
http://svn.nuxeo.org/trac/nuxeo/browser/tools/eclipse-config/nuxeo_formatter.xml?format=raw

Florent

-- 
Florent Guillaume, Head of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87


Re: Coding conventions

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Thu, Aug 13, 2009 at 5:40 PM, David
Caruana<da...@alfresco.com> wrote:
> Quick question...  are there any Apache guidelines for coding conventions?

No, each project sets their own coding conventions.

Most of the Java projects at Apache tend to stick pretty close to the
standard Java conventions which makes it easier to migrate code
between projects, but that's no fixed rule.

Another pretty widely adopted convention is to use spaces instead of
tabs for indentation. That makes cooperation easier as everyone will
see the code indented in the same way regardless of their tab
settings.

BR,

Jukka Zitting