You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Greg Brown <gk...@mac.com> on 2009/11/11 14:43:10 UTC

Re: svn commit: r834865

Noel,

Great work on your recent checkins - thanks! I just have a couple  
minor coding style comments:

- Don't include a space after a cast operator.

- Do include spaces around mathematical operators (e.g. 1 + 2 vs. 1+2).

- Try to structure your methods to use a single return statement,  
rather than returning from arbitrary points in the method. It makes it  
easier to follow the logic.

Thanks!
Greg


Re: svn commit: r834865

Posted by Greg Brown <gk...@mac.com>.
Yeah, yeah - I know you think my methods are too long.  ;-)  But in  
this context, "long" means "anything more than 3 or 4 lines".

You may disagree, but I find that a single return value does improve  
readability.


On Nov 11, 2009, at 9:12 AM, Christopher Brind wrote:

> You could argue that if your methods are that long, they are doing  
> too much.
> :)
>
>
> 2009/11/11 Greg Brown <gk...@mac.com>
>
>> I thought Todd had checked in an eclipse-formatter file? I can't  
>> seem to
>>> find it in SVN right now.
>>>
>>
>> It was moved to the new /project branch Todd created (it used to be  
>> in a
>> /project sub-directory of /trunk):
>>
>> http://svn.apache.org/repos/asf/incubator/pivot/project/pivot_style.xml
>>
>> It is also in the Wiki:
>>
>> http://cwiki.apache.org/confluence/display/PIVOT/Platform+Developer+Info
>>
>>
>> Cool, I'm happy to follow the pivot-style, although I disagree with  
>> the
>>> Pascal-style single-return-from-routine theory.
>>> I'm in the linux-kernel-style multiple-return early-exit camp :-)
>>>
>>
>> Though I generally don't use the style myself, I do think multiple  
>> returns
>> are OK for trivial methods. However, I think it has a negative  
>> effect on
>> readability for longer methods.
>>
>>


Re: svn commit: r834865

Posted by Christopher Brind <ch...@googlemail.com>.
You could argue that if your methods are that long, they are doing too much.
:)


2009/11/11 Greg Brown <gk...@mac.com>

> I thought Todd had checked in an eclipse-formatter file? I can't seem to
>> find it in SVN right now.
>>
>
> It was moved to the new /project branch Todd created (it used to be in a
> /project sub-directory of /trunk):
>
> http://svn.apache.org/repos/asf/incubator/pivot/project/pivot_style.xml
>
> It is also in the Wiki:
>
> http://cwiki.apache.org/confluence/display/PIVOT/Platform+Developer+Info
>
>
>  Cool, I'm happy to follow the pivot-style, although I disagree with the
>> Pascal-style single-return-from-routine theory.
>> I'm in the linux-kernel-style multiple-return early-exit camp :-)
>>
>
> Though I generally don't use the style myself, I do think multiple returns
> are OK for trivial methods. However, I think it has a negative effect on
> readability for longer methods.
>
>

Re: svn commit: r834865

Posted by Greg Brown <gk...@mac.com>.
> I thought Todd had checked in an eclipse-formatter file? I can't  
> seem to
> find it in SVN right now.

It was moved to the new /project branch Todd created (it used to be in  
a /project sub-directory of /trunk):

http://svn.apache.org/repos/asf/incubator/pivot/project/pivot_style.xml

It is also in the Wiki:

http://cwiki.apache.org/confluence/display/PIVOT/Platform+Developer+Info

> Cool, I'm happy to follow the pivot-style, although I disagree with  
> the
> Pascal-style single-return-from-routine theory.
> I'm in the linux-kernel-style multiple-return early-exit camp :-)

Though I generally don't use the style myself, I do think multiple  
returns are OK for trivial methods. However, I think it has a negative  
effect on readability for longer methods.


Re: svn commit: r834865

Posted by Noel Grandin <no...@gmail.com>.
Thanks. I have some free time right now (at least until the next crisis
at work erupts), so I'm picking off the simpler issues from the JIRA.

I thought Todd had checked in an eclipse-formatter file? I can't seem to
find it in SVN right now.

Cool, I'm happy to follow the pivot-style, although I disagree with the
Pascal-style single-return-from-routine theory.
I'm in the linux-kernel-style multiple-return early-exit camp :-)

-- Noel.

Greg Brown wrote:
> Noel,
>
> Great work on your recent checkins - thanks! I just have a couple
> minor coding style comments:
>
> - Don't include a space after a cast operator.
>
> - Do include spaces around mathematical operators (e.g. 1 + 2 vs. 1+2).
>
> - Try to structure your methods to use a single return statement,
> rather than returning from arbitrary points in the method. It makes it
> easier to follow the logic.
>
> Thanks!
> Greg
>