On 25.04.2016 17:21, Dougherty, Gregory T., M.S. wrote:
On 4/25/16, 9:38 AM, "Leon Rosenberg" <rosenberg.l...@gmail.com> wrote:
The other thing that made me wonder is that most people on the list (or
all
except me) actually considered if-else-if-else more readable. It not only
creates a more complex structure (visually and syntactically (more
letters)). But also the semantics of an *else* are different as of an
*if*.
This is like North Carolina ;-)
if (man){ do_man_thing; } else { do_woman_thing(); } doesn't work anymore,
even it worked 20 years ago. Talking about maintaining :-)
regards
Leon
Yes, we do, because, well, it is more informative. :-)
if (a) Š
else if (b) Š
else if (c) Š
Says you have three mutually exclusive options, and implies that a is more
likely / more important than b, than c.
Or, if ³a" is a method call, possibly that ³a² has some setup needed for
³b² and ³c².
Now that would be *really* maintainer-unfriendly, to say the least. Talk about obscure
side-effects. You do not even need a quantum CPU in that case..
All of this is lost with multiple if statements.
Then there¹s the everlasting wisdom of Knuth¹s comment about "premature
optimization is the root of all evil².
Write clean, readable, correct, code. If nothing else, this will provide
the data for your unit tests when you start optimizing.
Once you have a working implementation, then figure out where your time¹s
being spent. But your starting pattern should always be ³clean, readable,
correct², and if the options are mutually exclusive ³if .. else if² is
what meets that requirement.
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org