[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bugfix for issue 1630 (issue4490045)
From: |
David Kastrup |
Subject: |
Re: Bugfix for issue 1630 (issue4490045) |
Date: |
Sun, 29 May 2011 17:24:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
address@hidden writes:
> I just used inline conditionals as an example of a code style where
> conditions are inlined. More generally, there seem to be two views on
> readability:
>
> One could be summarized as "Don't do more than one thing in one line"
> (for example inline conditions that might come as evaluation of a
> boolean expression within an assignment, or inline conditionals). The
> code is easier to "parse" for a new reader and easier to debug. This
> view seems to be popular in the Java world.
>
> The other take is "Compact code is more readable" as in the proposed
> change. If an experienced reader recognizes patterns such as "Boolean
> evaluation inside an argument" the code may be faster to read (unless
> the code is too compact).
We are not talking about compact code here but code duplication. Since
the duplication occurs in different execution paths, it is not per se a
performance issue (though branch prediction can be expensive nowadays),
but it means having to read both branches to figure out what is doing
done.
It also means having to do a complex text comparison to figure out how
the two different code paths differ.
Personally, I find having to parse things like
if (condition != false) then somethingcomplicated(true)
else somethingcomplicated(false)
annoying and contorted.
--
David Kastrup
- Re: Bugfix for issue 1630 (issue4490045), (continued)
- Re: Bugfix for issue 1630 (issue4490045), karin . hoethker, 2011/05/26
- Re: Bugfix for issue 1630 (issue4490045), percival . music . ca, 2011/05/26
- Re: Bugfix for issue 1630 (issue4490045), lemniskata . bernoullego, 2011/05/29
- Re: Bugfix for issue 1630 (issue4490045), benko . pal, 2011/05/29
- Re: Bugfix for issue 1630 (issue4490045), Carl . D . Sorensen, 2011/05/29
- Re: Bugfix for issue 1630 (issue4490045), karin . hoethker, 2011/05/29
- Re: Bugfix for issue 1630 (issue4490045), Carl . D . Sorensen, 2011/05/29
- Re: Bugfix for issue 1630 (issue4490045), karin . hoethker, 2011/05/29
- Re: Bugfix for issue 1630 (issue4490045),
David Kastrup <=
- Re: Bugfix for issue 1630 (issue4490045), percival . music . ca, 2011/05/30
- Re: Bugfix for issue 1630 (issue4490045), lemniskata . bernoullego, 2011/05/30
- Re: Bugfix for issue 1630 (issue4490045), Carl . D . Sorensen, 2011/05/30
- Re: Bugfix for issue 1630 (issue4490045), benko . pal, 2011/05/30