Re: Function size

From: Date: Thu, 24 May 2012 02:39:23 +0000
Subject: Re: Function size
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-317974@lists.php.net to get a copy of this message
Tedd Sperling <tedd@sperling.com> writes: > It would be an interesting survey to ask programmers to review their code and > provide the average number of lines in their functions AND how many lines of > code their monitor's can display. In other words, look at your editor; count the > number of lines your monitor can display; estimate the number of lines in your > average function; and report the findings. For example, mine is about half -- > my monitor can display 55 lines of code and my average function is around 25 > lines. YMMV. > > Interesting, yes? > > Cheers, > > tedd > > > _____________________ > tedd.sperling@gmail.com > http://sperling.com My monitor can also display about 55 lines of code, my functions are, on average, just a few lines of code though -- a maximum of about 20, with an average of around 5 or so. This is because the rule of thumb I follow is that a function should do one thing, and should be named well. The biggest downside to the type of style I have is that if not done "correctly", people can feel like they're swimming in a sea of chasing down functions to find out wtf is going on. When done "correctly", it leads to pretty clear code, IMO.

« previous php.general (#317974) next »