in reply to When do you function?
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re (tilly) 1: When do you function?
by a (Friar) on Dec 27, 2000 at 09:44 UTC | |
Re: Re (tilly) 1: When do you function?
by puck (Scribe) on Dec 28, 2000 at 02:33 UTC | |
by BBQ (Curate) on Dec 28, 2000 at 08:25 UTC |