|There's more than one way to do things|
Re: Re: Re: Short routines matter more in OO?by Juerd (Abbot)
|on Oct 13, 2003 at 16:28 UTC||Need Help??|
Less error prone? Five studies cited by McConnel found that routine size was either inversely correlated with error frequency, or not correlated at all
The studies could be right.
Less changes required? Another study finds that code needs to be changed least when routines average 100 - 150 lines.
The study could be right.
On the other hand, we have your unsupported opinion.
Yeah. Unsupported. Maybe even wrong.
But I have found small things to be easier to maintain. More flexible. Easier to change, even though more lines change. Easier to re-use. Small subs are usually easier to read and understand.
Easier to document. This is worth a lot.
Whether or not short subs work for you depends on more than Perl alone. Short subs are better than long subs, much like how short sentences are better than long sentences. The long ones may seem more brilliant and more intelligent, but the shorter ones are clearer and much easier to read.
Guess why books for children use short sentences. Guess why most programming introductions start with printing Hello, world.
Of course, programs/modules with short subroutines are harder to create (since it requires more design) and slower.
I do not know of any study that supports my opinion.