Re: Function size

From: Date: Wed, 23 May 2012 15:49:29 +0000
Subject: Re: Function size
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-317952@lists.php.net to get a copy of this message
On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling <tedd@sperling.com> wrote: > Hi gang: > > On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: > > A rule of thumb is no more than 50 lines per > > function, most much less. Back in the day when we didn't have nifty > > gui screens and an 24 line terminals (yay green on black!), if a > > function exceeded one printed page, it was deemed too long and marked > > for refactoring. > > You hit upon a theory of mine -- and that is our functions grow in size up > to our ability to view them in their totality. When our functions get > beyond that limit, we tend to refactor and reduce. > When number of lines becomes the criteria of function size? Wouldn't it depends on the task the function is doing? I follow this rule, *Each time I end up need a code block I wrote earlier, I convert it to a function. *So simple. This way you re-factor your code automatically and you dont do any copy paste. Last year someone on Stackoverflow asked something like this[1]. And that was my answer. [1] http://stackoverflow.com/a/8597409/376535 > -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader

« previous php.general (#317952) next »