You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by Erlend Garåsen <e....@usit.uio.no> on 2012/10/15 14:28:57 UTC
[DISCUSS] Java coding style
Nope, I'm NOT starting a discussion about changing anything. It's just
about clarifying a few things. So no worries! ;)
According to:
https://cwiki.apache.org/confluence/display/CONNECTORS/HowToContribute#HowToContribute-MakingChanges
As long as I'm following these two guidelines, I guess everything is fine:
- Code should be formatted according to Sun's conventions, with one
exception:
- indent two spaces per level, not four.
The thing is that the majority of the source code in MCF uses a
different style than I'm used to, even though it follows the points
above. For instance, I'm used to code blocks like this, having the curly
braces on the first and last line:
void myMethod() {
...
}
I find it more difficult to write:
void myMethod()
{
...
}
So the questions is: Is it OK that I use the coding style in my first
example above or should we all use the other one?
Until now, I have used the latter, but that's because I haven't written
anything from scratch, just implemented new functionality in existing
classes.
If I'll suggest anything, it will be that you may choose as long as you
follow the two requirements from the Wiki, but continues to use the same
coding style in existing classes if you're just going to do a minor change.
Erlend
--
Erlend Garåsen
Center for Information Technology Services
University of Oslo
P.O. Box 1086 Blindern, N-0317 OSLO, Norway
Ph: (+47) 22840193, Fax: (+47) 22852970, Mobile: (+47) 91380968, VIP: 31050
Re: [DISCUSS] Java coding style
Posted by Karl Wright <da...@gmail.com>.
As far as I'm concerned, either coding style is OK. But having the
wrong number of spaces for indent is not. Nor is using tabs instead
of spaces.
The only other rule I think we should really enforce is for any
significant changes to the style of a class to be checked in or
patched independently of any functional changes. Otherwise we can't
effectively review the changes.
My thought here is that it is relatively easy to change the position
of the leading brace through a search/replace operation. It is much
harder to fix other issues.
Thanks,
Karl
On Mon, Oct 15, 2012 at 8:28 AM, Erlend Garåsen <e....@usit.uio.no> wrote:
>
> Nope, I'm NOT starting a discussion about changing anything. It's just about
> clarifying a few things. So no worries! ;)
>
> According to:
> https://cwiki.apache.org/confluence/display/CONNECTORS/HowToContribute#HowToContribute-MakingChanges
>
> As long as I'm following these two guidelines, I guess everything is fine:
> - Code should be formatted according to Sun's conventions, with one
> exception:
> - indent two spaces per level, not four.
>
> The thing is that the majority of the source code in MCF uses a different
> style than I'm used to, even though it follows the points above. For
> instance, I'm used to code blocks like this, having the curly braces on the
> first and last line:
> void myMethod() {
> ...
> }
>
> I find it more difficult to write:
> void myMethod()
> {
> ...
> }
>
> So the questions is: Is it OK that I use the coding style in my first
> example above or should we all use the other one?
>
> Until now, I have used the latter, but that's because I haven't written
> anything from scratch, just implemented new functionality in existing
> classes.
>
> If I'll suggest anything, it will be that you may choose as long as you
> follow the two requirements from the Wiki, but continues to use the same
> coding style in existing classes if you're just going to do a minor change.
>
> Erlend
>
> --
> Erlend Garåsen
> Center for Information Technology Services
> University of Oslo
> P.O. Box 1086 Blindern, N-0317 OSLO, Norway
> Ph: (+47) 22840193, Fax: (+47) 22852970, Mobile: (+47) 91380968, VIP: 31050
>
>