Pitch said:
Ok. I'd like to think readability is more important than performance.
This statements seems somewhat odd to me, because you seem
to insinuate that I had written »price with regard to
performance«. Actually, this makes me somewhat annoyed,
because I clearly did not write this. So this seem to be a
http://en.wikipedia.org/wiki/Straw_man
against me.
And what is the intention of the symbol »
«? Do you want
to express that this idea seems funny to you, or that you
are just kidding? I am investing effort and time to
decipher this ambigous symbol »
«, which only adds to my
annoyance, because you could have avoided this by using a
more explicit and unambiguous means to express whatever
you wanted to express with »
«.
Additional methods have a price also with regard to
readability:
o A custom method can hide well-known standard
API-methods. The reader might have immediatly known
the meaning of the standard API-calls, but will have
to look up the meaning of your custom method.
o A custom method increases code size by adding
its interface and documentation, making it harder
to browse and maintain the code.
o The additional methods increase the number of
entities in the code (the code complexity), which
makes it harder to keep them in mind.
Here is some evidence:
o Basili and Perricone found that routine size was
inversely correlated with errors: as the size of
routines increased (up to 200 lines of code), the
number of errors per line of code decreased (Basili
and Perricone 1984).
o A 1986 study found that small routines (32 lines of
code or fewer) were not correlated with lower cost or
fault rate (Card, Church, and Agresti 1986; Card and
Glass 1990). The evidence suggested that larger
routines (65 lines of code or more) were cheaper to
develop per line of code.
http://www.c2.com/cgi/wiki?LongFunctions
o Routines with fewer than 143 source statements
(including comments) had 23% more errors per line of
code than larger routines. [Selby and Basili, 1991]
http://dubroy.com/blog/method-length-are-short-methods-actually-worse/
There is an optimum somewhere in between too large
and too small:
http://www.leshatton.org/Documents/Ubend_IS697.pdf