S
SW
James said:I don't think you can set an absolute maximum limit, as there
are special cases. (Consider a function which consists of a
single switch statement, with a 100 or so cases.) But in
general, anything over about 10 lines in a function should raise
eyebrows; well written functions are *usually* fairly short. (I
did some statistics on my code once, and found that the average
function length was around 7 lines. I'm not too sure how
significant that is, however, since I'm pretty sure that the
variance is important.)
I agree that functions should be short and concise. I think that it is
also important to write deterministic functions as often as possible. It
can make reasoning a lot easier.
SW