![]() |
|
The stupid question is the question not asked | |
PerlMonks |
Re (tilly) 1: When do you function?by tilly (Archbishop) |
on Dec 27, 2000 at 09:16 UTC ( #48384=note: print w/replies, xml ) | Need Help?? |
Hopefully most of the time. :-) Seriously I find that my average function is about 10 lines. Some are shorter - a lot shorter. A few are much longer. But that seems to be an average for me. Here is a list of reasons from chapter 5 of Code Complete to think about. I won't copy explanations, just the reasons:
So while that list doesn't hold perfectly for Perl, it is still generally on target. Note that in particular comments explaining what you intended at one point are not a good substitute for clear code. Should you change the code later, the comments will often remain to confuse you. Also deeply nested loops may not take many lines, but they make it much harder to separate the forest from the trees.
In Section
Meditations
|
|