Russell,

I agree with most of your reasoning. I am not saying that there is a
problem, nor am I saying anything about the severity of such a problem,
should it exist. I am merely saying that there _may_ be a problem. A
problem which I perceive as psychological in nature, and thus do I, as
a programmer, not feel qualified to draw conclusions about it.

Personally I have no difficulty interpreting either way of doing the
comparison, and was quite surprised when this issue was raise by a
programmer, that cannot be characterized as a beginner. Furthermore,
during a revision of our company C/C++ coding standard, I suggested
adding the reversed comparsion as a guideline, but it met strong
opposition, and was dismissed as being "unnatural". This shows that
even experienced programmers can feel uncomfortable with reversed
comparison. Whether this originates in cognitive difficulties or
merely personal dislikes, I don't know.

However, I do suspect that the visual closeness of the assignment and
comparison operators versus their commutative properties (comparison
is commutative, assignment is not), could cause confusion in subtle
ways. So I am not convinced that this is solely a learning problem.

If the assignment error (using assignment instead of comparison within
an if statement) can evade the attention of the programmer, then surely
the misinterpretion of a reversed comparison is also possible. Here I
assume that both cases occurs because the programmer does not have the
sufficient time to dwell upon each line -- this is usually the case
during debugging sessions.

Please note that I am not arguing against reversed comparison. Instead
I am arguing in favour of a psychological study, rather than a logical
reasoning, to determine if the problem is real, and if so, whether the
pros of the reversed comparison outweights the cons.

It would also be interesting to conduct similar studies for other
typical coding standard guidelines (not only to Derek and I, but to
the programming community at large).

- Automatic footer for [EMAIL PROTECTED] ----------------------------------
To unsubscribe from this list, mail [EMAIL PROTECTED]  unsubscribe discuss
To join the announcements list, mail [EMAIL PROTECTED] subscribe announce
To receive a help file, mail [EMAIL PROTECTED]         help
This list is archived at http://www.mail-archive.com/discuss%40ppig.org/
If you have any problems or questions, please mail [EMAIL PROTECTED]

Reply via email to