You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Henri Yandell <fl...@gmail.com> on 2005/12/30 05:25:00 UTC

Style question

Generally I ignore coding style and just match the style of the file
I'm editing, or the package I'm adding a class to etc. I noticed one
bit that isn't usually done in Java, usually it's a C habit I think:

if ( null != mVariable )

instead of:

if ( mVariable != null )

Is this a contentious one, or something to easily fix as and when it's seen?

Hen

Re: Style question

Posted by Lance Lavandowska <la...@gmail.com>.
I would say "fix it" if you are editing the code, but don't seek them
out to change.

Of course, I have no C habit's to change.

On 12/29/05, Henri Yandell <fl...@gmail.com> wrote:
> Generally I ignore coding style and just match the style of the file
> I'm editing, or the package I'm adding a class to etc. I noticed one
> bit that isn't usually done in Java, usually it's a C habit I think:
>
> if ( null != mVariable )
>
> instead of:
>
> if ( mVariable != null )
>
> Is this a contentious one, or something to easily fix as and when it's seen?
>
> Hen
>

Re: Style question

Posted by Allen Gilliland <Al...@Sun.COM>.
The plan is to just follow the standard Java coding conventions.  I 
don't recall if they mention this specific situation, but personally I 
prefer to see the variable name first because it's easier to read.  The 
only time I've ever seen a reversal like that is when doing something 
like ...

if("".equals(variable))

this is useful if you don't want to exlicitly check that "variable" is 
non-null before trying to use the .equals() method.

-- Allen


Henri Yandell wrote:

>Generally I ignore coding style and just match the style of the file
>I'm editing, or the package I'm adding a class to etc. I noticed one
>bit that isn't usually done in Java, usually it's 
>
>a C habit I think:
>
>if ( null != mVariable )
>
>instead of:
>
>if ( mVariable != null )
>
>Is this a contentious one, or something to easily fix as and when it's seen?
>
>Hen
>  
>