You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by David M Johnson <Da...@Sun.COM> on 2005/08/02 15:02:52 UTC

Roller code conventions

Currently, Roller's coding standard is the same as the Java coding 
conventions except we use Allman/BSD style indentation with 4 spaces, 
and no tabs instead of K&R style.

    Sun's conventions:
    <http://java.sun.com/docs/codeconv/>

    Hacker's dictionary indent style page (explains K&R versus Allman, 
etc.):
    <http://www.catb.org/~esr/jargon/html/I/indent-style.html>

Personally, I'd like to switch to K&R style. It's more in-line with the 
official Java conversion and I believe it's more commonly used in open 
source projects and therefore easier for most to follow.

New code has been creeping in with K&R style already and that bothers 
me. I'd like to have common coding conventions across the project.

Seems like we have three choices:
1) keep current standard and ask that all folks follow it
2) switch from Allman to K&R indentation, to make it easier for folks 
to follow the rules
3) don't care about coding conventions

Thoughts?

  - Dave


Re: Roller code conventions

Posted by Matt Raible <mr...@gmail.com>.
+1 for K & R b/c that's what I use on my projects.  More comments below...

On 8/2/05, David M Johnson <Da...@sun.com> wrote:
> Currently, Roller's coding standard is the same as the Java coding
> conventions except we use Allman/BSD style indentation with 4 spaces,
> and no tabs instead of K&R style.
> 
>     Sun's conventions:
>     <http://java.sun.com/docs/codeconv/>
> 
>     Hacker's dictionary indent style page (explains K&R versus Allman,
> etc.):
>     <http://www.catb.org/~esr/jargon/html/I/indent-style.html>
> 
> Personally, I'd like to switch to K&R style. It's more in-line with the
> official Java conversion and I believe it's more commonly used in open
> source projects and therefore easier for most to follow.
> 
> New code has been creeping in with K&R style already and that bothers
> me. I'd like to have common coding conventions across the project.

If people committing code that doesn't fit a certain style bothers
you, I'd like to suggest we add something like Jalopy or Checkstyle to
the build in order to enforce a formatting policy. You could make
"compile" depend on checkstyle so you can't compile until you meet all
the rules.  This is what the Cargo project on Codehaus does.

Matt

> 
> Seems like we have three choices:
> 1) keep current standard and ask that all folks follow it
> 2) switch from Allman to K&R indentation, to make it easier for folks
> to follow the rules
> 3) don't care about coding conventions
> 
> Thoughts?
> 
>   - Dave
> 
>

Re: Roller code conventions

Posted by Allen Gilliland <Al...@Sun.COM>.
I am definitely for the K&R as well.

On Tue, 2005-08-02 at 07:19, Anil Gangolli wrote:
> My vote is to switch to K&R indentation, retaining the 4 spaces, no tabs 
> convention.
> 
> David M Johnson wrote:
> 
> > Currently, Roller's coding standard is the same as the Java coding 
> > conventions except we use Allman/BSD style indentation with 4 spaces, 
> > and no tabs instead of K&R style.
> >
> >    Sun's conventions:
> >    <http://java.sun.com/docs/codeconv/>
> >
> >    Hacker's dictionary indent style page (explains K&R versus Allman, 
> > etc.):
> >    <http://www.catb.org/~esr/jargon/html/I/indent-style.html>
> >
> > Personally, I'd like to switch to K&R style. It's more in-line with 
> > the official Java conversion and I believe it's more commonly used in 
> > open source projects and therefore easier for most to follow.
> >
> > New code has been creeping in with K&R style already and that bothers 
> > me. I'd like to have common coding conventions across the project.
> >
> > Seems like we have three choices:
> > 1) keep current standard and ask that all folks follow it
> > 2) switch from Allman to K&R indentation, to make it easier for folks 
> > to follow the rules
> > 3) don't care about coding conventions
> >
> > Thoughts?
> >
> >  - Dave
> >
> >
> 


Re: Roller code conventions

Posted by Anil Gangolli <an...@busybuddha.org>.
My vote is to switch to K&R indentation, retaining the 4 spaces, no tabs 
convention.

David M Johnson wrote:

> Currently, Roller's coding standard is the same as the Java coding 
> conventions except we use Allman/BSD style indentation with 4 spaces, 
> and no tabs instead of K&R style.
>
>    Sun's conventions:
>    <http://java.sun.com/docs/codeconv/>
>
>    Hacker's dictionary indent style page (explains K&R versus Allman, 
> etc.):
>    <http://www.catb.org/~esr/jargon/html/I/indent-style.html>
>
> Personally, I'd like to switch to K&R style. It's more in-line with 
> the official Java conversion and I believe it's more commonly used in 
> open source projects and therefore easier for most to follow.
>
> New code has been creeping in with K&R style already and that bothers 
> me. I'd like to have common coding conventions across the project.
>
> Seems like we have three choices:
> 1) keep current standard and ask that all folks follow it
> 2) switch from Allman to K&R indentation, to make it easier for folks 
> to follow the rules
> 3) don't care about coding conventions
>
> Thoughts?
>
>  - Dave
>
>


RE: Roller code conventions

Posted by "Noel J. Bergman" <no...@devtech.com>.
Lance Lavandowska wrote:

> I have a hard time reading K&R indented code (just a personal
> thing, no scientific evidence of superiority :-) ).

The general knock against K&R style is that the { is hard(er) to spot, and
can disappear against the closing ) of a conditional, particularly complex
ones.  The pro-K&R case is that it conserves vertical space.

I don't know about you, but I don't use 24 line teletype terminals to edit
my code anymore.

	--- Noel


Re: Roller code conventions

Posted by Lance Lavandowska <la...@gmail.com>.
I've expressed my preference for Allman in the past, in fact I have a
hard time reading K&R indented code (just a personal thing, no
scientific evidence of superiority :-) ).

That said, I've haven't made a code contribution in over a year, so I
consider my vote to carry less weight.

Lance

On 8/2/05, Noel J. Bergman <no...@devtech.com> wrote:
> Not that you should consider my view, but personally, I really dislike K&R
> style, despite the fact that we use it in JAMES.  I never use it in my own
> code.
> 
>         --- Noel
> 
>

RE: Roller code conventions

Posted by "Noel J. Bergman" <no...@devtech.com>.
Not that you should consider my view, but personally, I really dislike K&R
style, despite the fact that we use it in JAMES.  I never use it in my own
code.

	--- Noel