cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Collen <tcol...@neuagency.com>
Subject Re: Coding style question: backwards null checks
Date Fri, 07 Mar 2003 17:44:04 GMT
On Fri, 7 Mar 2003, Berin Loritsch wrote:

> Jeff Turner wrote:
> > Hi,
> >
> > Quick question.  Why do people put null checks backwards:
> >
> >   if ( null != this.inputSource ) {
> >
> > IMHO it is harder to read than
> >
> >   if ( this.inputSource != null ) {
> >
> > and means exactly the same thing.

Likewise, I've seen something like this in code... can't remember if it's
anywhere in Cocoon:

if ( "something".equals(stringToCompare) {
   ...
}

IMO it seems more straightforward and easier to read if it's:

if ( stringToCompare.equals("something") ) {
   ...
}

Is this just a matter of style as well?  The first way seems goofy if you
ask me.


Tony


Mime
View raw message