Studies and comprehension levels? Really? ;)
Forgive my blatant and possibly offensive observation, but programming
IS logic. If a PROGRAMMER has trouble comprehending simple "is/is not"
logic, (insert comment here). :)
If a procedure returns a Boolean value (Gasp! Two possible values: true
or false), why should any programmer test for both values, or discount
negatives, if only one value is important to the rest of the logic?
Seriously, how is "If not something();" different from "If something() =
false;" or "If something() = '0';?" They all mean the same thing: not =
'0' = false. To me, it's a matter of preference. Since my logic spans
several languages, "if not" is common and not difficult to read. I
would rather have recognizable commonalities between code variances than
gear myself up for avoidable nuances.
Just my opinion.
Tom Armbruster
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Simon Coulter
Sent: Monday, March 01, 2010 2:00 PM
To: RPG programming on the IBM i / System i
Subject: Re: More on RPG style
On 02/03/2010, at 8:33 AM, Kurt Anderson wrote:
My point is, "why is 'Not' hard to read/understand/parse?"
A fair number of studies have shown that "negative tests" are
generally harder for people to comprehend than "positive tests".
Although it is possible to train yourself to handle negative tests
more easily, positive tests still parse faster (by humans). Therefore
it is nearly always better to write:
if ( something equal otherthing )
than
if ( something not equal otherthing )
or
if NOT( something equal otherthing )
For simple tests such as the above there is not much difference
especially for people whose lives are spent reading such things but
once the tests become more complex the difference in comprehension
becomes quite marked.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.