Frank,
Use of () does remove the need to know what the precedence is.
However, as the source code measurements in the two tables
show, there is lots of code that does not make use of ().
Not all code is read equally. If it works, nobody has
to bother comprehending it; if it doesn't work, it tends
It doesn't matter how often code is read, or even if it is
ever read once written. The subjects have to think about
operators when they are writing it, so this is the connection
to occurrences in source code. Now what about code that does
get read, do we assume a uniform distribution, or is the
complicated stuff read more often? It probably doesn't matter,
we are only interested in the relative amount that gets read/written.
We only need to assume a uniform distribution in the set of operators
that are read.
Ok, there is the possibility that code containing some operators will
get read more often than code containing other operators. For
the time being I am happy to assume the consequences of this are
small.
All the binary operators common to these languages share the
same precedence.
Depends what you mean by "common to"; for example, '+' works
rather differently in perl, Javascript and C.
What the operators actually do is irrelevant. When the expression
a + b * c is encountered the reader has to figure out which
operator apply to which operators (the subject of this experiment),
then they can worry about what the operators actually do.
The language assumption I make is that relative occurrence of
operators is the same across languages. I have heard people claim
that object orientation changes language usage completely. While
OO may change a developers perception of algorithms I don't think
it has much impact on things like operator usage. I hope to have
measurements to back that up at some point in the near future.
I also note that you titled your paper "Developer beliefs
about binary operator precedence", yet I don't actually see anything
in your paper that supports the contention that you know what
those beliefs are. Perhaps I missed it.
I set out to find out what those beliefs were by asking them to
answer precedence problems.
--
Derek M. Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd mailto:[EMAIL PROTECTED]
Applications Standards Conformance Testing http://www.knosof.co.uk
----------------------------------------------------------------------
PPIG Discuss List (discuss@ppig.org)
Discuss admin: http://limitlessmail.net/mailman/listinfo/discuss
Announce admin: http://limitlessmail.net/mailman/listinfo/announce
PPIG Discuss archive: http://www.mail-archive.com/discuss%40ppig.org/