You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by Robert Burrell Donkin <ro...@blueyonder.co.uk> on 2012/09/29 20:22:02 UTC

Code Style [WAS Re: Various dev questions :-)]

On 09/27/12 09:39, Olivier Lamy wrote:

<snip>

> I have some questions around dev for rat stuff:
> * is there any code style defined ? (I have seen various code style
> while navigating in the code: "standard sun style", maven style)

We should probably pick a style and format just before the next release

Robert

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by Jochen Wiedmann <jo...@gmail.com>.
Amen to everything, sebb!

On Sun, Sep 30, 2012 at 4:20 PM, sebb <se...@gmail.com> wrote:
> The only rule I hope we can agree on is no TAB characters.
> This because TAB settings are variable and can badly mess up indentation.
>
> Consistency within a single source file is desirable for readability -
> e.g. it's awkward to follow if indentation is not consistent.
>
> But I don't see a particular advantage to consistency across all files
> and file types.
>
> For example, XML files often have deep nesting, so an indent of 2
> chars is often better.
> Whereas Java files don't (or should not) have deeply nested conditions
> so 4 chars indentation is probably more readable.
>
> IMO changing code to suit some arbitrary checkstyle rules is a waste
> of time (and wasted effort reviewing changes).
>
>
> On 29 September 2012 20:27, Olivier Lamy <ol...@apache.org> wrote:
>> /me was just asking and don't want to start any holy war :-)
>>
>> 2012/9/29 Robert Burrell Donkin <ro...@blueyonder.co.uk>:
>>> On 09/29/12 19:31, Jochen Wiedmann wrote:
>>>>
>>>> -1: I am just happy with different styles and don't see advantages in a
>>>> common.
>>>
>>>
>>> Fine by me
>>>
>>> Robert
>>
>>
>>
>> --
>> Olivier Lamy
>> Talend: http://coders.talend.com
>> http://twitter.com/olamy | http://linkedin.com/in/olamy



-- 
The best argument for celibacy is that the clergy will sooner or later
become extinct.

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by "P. Ottlinger" <po...@aiki-it.de>.
Hi *,

Am 01.10.2012 13:18, schrieb sebb:
>> >
>> > but some time ago I suggested an automatic solution that gets applied
>> > before every checkin - thus each developer may work with his/her code
>> > styles and the SVN repo contains one consistent view on the sources:
>> > https://issues.apache.org/jira/browse/RAT-103
> This will change the user's workspace, so they only get to work with
> their style once.
> It will also tend to cause issues with IDEs which will have to resync.

There is no change in any user's workspace - one configuration is
checked in. This is used to perform the formatting during any mvn run.
It's independent of the user's setting (or the user's IDE).

The "big" formatting takes place once - after that only each changed
file gets reformatted ... thus it's not a big deal.

We do use this tool on a rather big codebase without any hazzle - only
the initial cleanup/formatting may take some time.

Cheers
Phil


Re: Code Style [WAS Re: Various dev questions :-)]

Posted by sebb <se...@gmail.com>.
On 30 September 2012 18:58, P. Ottlinger <po...@aiki-it.de> wrote:
> Hi everyone,
>
> I don't want to start any holy war as well ....
>
> Am 30.09.2012 16:20, schrieb sebb:
>> IMO changing code to suit some arbitrary checkstyle rules is a waste
>> of time (and wasted effort reviewing changes).
>
> but some time ago I suggested an automatic solution that gets applied
> before every checkin - thus each developer may work with his/her code
> styles and the SVN repo contains one consistent view on the sources:
> https://issues.apache.org/jira/browse/RAT-103

This will change the user's workspace, so they only get to work with
their style once.
It will also tend to cause issues with IDEs which will have to resync.

> This only applies to *.java and is performed during each run of 'mvn
> install' - so no active waste of developer time!

Except that the process will take longer, especially on a large code base.
Even fixing things like EOL markers can take an appreciable time.

Not everyone uses Maven for development / testing.
I rarely use mvn install.

> To my mind good code should be easy and good to read ...
> I'm not convinced of: "If it was hard to write, it should be hard to
> understand" :-D

Indeed, but enforced global consistency is not a guarantee of readability.

> Cheers,
> Phil

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by "P. Ottlinger" <po...@aiki-it.de>.
Hi everyone,

I don't want to start any holy war as well ....

Am 30.09.2012 16:20, schrieb sebb:
> IMO changing code to suit some arbitrary checkstyle rules is a waste
> of time (and wasted effort reviewing changes).

but some time ago I suggested an automatic solution that gets applied
before every checkin - thus each developer may work with his/her code
styles and the SVN repo contains one consistent view on the sources:
https://issues.apache.org/jira/browse/RAT-103

This only applies to *.java and is performed during each run of 'mvn
install' - so no active waste of developer time!

To my mind good code should be easy and good to read ...
I'm not convinced of: "If it was hard to write, it should be hard to
understand" :-D

Cheers,
Phil

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by sebb <se...@gmail.com>.
The only rule I hope we can agree on is no TAB characters.
This because TAB settings are variable and can badly mess up indentation.

Consistency within a single source file is desirable for readability -
e.g. it's awkward to follow if indentation is not consistent.

But I don't see a particular advantage to consistency across all files
and file types.

For example, XML files often have deep nesting, so an indent of 2
chars is often better.
Whereas Java files don't (or should not) have deeply nested conditions
so 4 chars indentation is probably more readable.

IMO changing code to suit some arbitrary checkstyle rules is a waste
of time (and wasted effort reviewing changes).


On 29 September 2012 20:27, Olivier Lamy <ol...@apache.org> wrote:
> /me was just asking and don't want to start any holy war :-)
>
> 2012/9/29 Robert Burrell Donkin <ro...@blueyonder.co.uk>:
>> On 09/29/12 19:31, Jochen Wiedmann wrote:
>>>
>>> -1: I am just happy with different styles and don't see advantages in a
>>> common.
>>
>>
>> Fine by me
>>
>> Robert
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by Olivier Lamy <ol...@apache.org>.
/me was just asking and don't want to start any holy war :-)

2012/9/29 Robert Burrell Donkin <ro...@blueyonder.co.uk>:
> On 09/29/12 19:31, Jochen Wiedmann wrote:
>>
>> -1: I am just happy with different styles and don't see advantages in a
>> common.
>
>
> Fine by me
>
> Robert



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by Robert Burrell Donkin <ro...@blueyonder.co.uk>.
On 09/29/12 19:31, Jochen Wiedmann wrote:
> -1: I am just happy with different styles and don't see advantages in a common.

Fine by me

Robert

Re: Code Style [WAS Re: Various dev questions :-)]

Posted by Jochen Wiedmann <jo...@gmail.com>.
-1: I am just happy with different styles and don't see advantages in a common.


On Sat, Sep 29, 2012 at 8:22 PM, Robert Burrell Donkin
<ro...@blueyonder.co.uk> wrote:
> On 09/27/12 09:39, Olivier Lamy wrote:
>
> <snip>
>
>> I have some questions around dev for rat stuff:
>> * is there any code style defined ? (I have seen various code style
>> while navigating in the code: "standard sun style", maven style)
>
>
> We should probably pick a style and format just before the next release
>
> Robert



-- 
The best argument for celibacy is that the clergy will sooner or later
become extinct.