Oh yeah, I meant to add...
"Premature optimization is the root of all evil."
- Donald Knuth
If everyone held that tenet, there'd be 35% fewer software bugs (and
probably, they'd be the 35% that are hardest to debug)!
David
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Tony Spencer
Sent: Thursday, July 22, 2004 3:37 PM
To: 'Research Triangle Java User's Group mailing list.'
Subject: RE: [Juglist] Which is more efficient?
I certainly agree it looks nicer. My concern was whether or not it performs
worse. I'm guessing its negligible if it does.
T O N Y S P E N C E R
Notsleepy LLC
6512 Six Forks Rd.
Suite 502-B
Raleigh, NC 27615
Phone: 919.848.0691
Mobile: 415.637.6481
[EMAIL PROTECTED]
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Sent: Thursday, July 22, 2004 3:22 PM
> To: Research Triangle Java User's Group mailing list.
> Subject: Re: [Juglist] Which is more efficient?
>
> I would agree with Chris. If someone asked you to describe
> what you are trying to accomplish, you'd probably say something like:
>
> "Well, I want to get the form comments. If they're null, I
> want to default to an empty string"
>
> And
>
> > String formcomments = attr.getFormComments(); if
> (formcommets == null)
> > formcomments = "";
>
> pretty much says it all.
>
> Rowland
>
> > My preference always goes to the easiest to read...I would write:
> >
> > String formcomments = attr.getFormComments(); if
> (formcommets == null)
> > formcomments = "";
> >
> > IMO, it is more obvious that the result (formcomments) will be
> > assigned the value of attr.getFormComments(), unless the
> special case
> > (null) is encountered.
> >
> >
> >
> > C
> >
> >
> > disclaimer: This advice is worth exactly what you paid for
> it...maybe
> > less.
> >
> >
> > Tony Spencer wrote:
> >> Which of these examples is better practice or does not not really
> >> matter?
> >>
> >> Example 1:
> >>
> >> String formcomments = attr.getFormComments(); formcomments =
> >> (formcomments == null) ? "" : formcomments;
> >>
> >>
> >> Example 2:
> >> String formcomments = (attr.getFormComments()== null) ? "" :
> >> attr.getFormComments();
> >
> >
> > --
> >
> --------------------------------------------------------------
> -----------
> > Chris Merrill | http://www.webperformanceinc.com
> > Web Performance Inc. |
> http://www.webperformancemonitoring.net
> >
> > Website Load Testing, Stress Testing, and Performance Monitoring
> > Software
> >
> ----------------------------------------------------------------------
> > ---
> >
> >
> > _______________________________________________
> > Juglist mailing list
> > [EMAIL PROTECTED]
> > http://trijug.org/mailman/listinfo/juglist_trijug.org
> >
>
>
> _______________________________________________
> Juglist mailing list
> [EMAIL PROTECTED]
> http://trijug.org/mailman/listinfo/juglist_trijug.org
>
>
_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org
_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org