Re: [PHP] Function size

2012-05-29 Thread Stuart Dallas
On 23 May 2012, at 15:14, Tedd Sperling 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

Re: [PHP] Function size

2012-05-29 Thread Stuart Dallas
On 29 May 2012, at 14:38, Tedd Sperling wrote: On May 29, 2012, at 7:17 AM, Stuart Dallas wrote: It's a theory, yes, and for many people it may be valid, but it's not for me. The resolution of your screen; the size of your font; the colour scheme you use. These should not be a factor in

Re: [PHP] Function size

2012-05-29 Thread Tedd Sperling
On May 29, 2012, at 10:20 AM, Stuart Dallas wrote: -snip- Besides, truth is subjective, but then so is everything, including that assertion. -Stuart You reply was longer than my monitor was high so I can't give an immediate reply -- I have to scroll. :-) However, with that said, you

Re: [PHP] Function size

2012-05-29 Thread Matijn Woudt
The art of software development is in taking a problem, breaking it up in to bite-size chunks, and putting those chunks together to form a practical solution. Anyone who considers themselves a better programmer because their functions are large due to their ability to handle large functions

Re: [PHP] Function size

2012-05-29 Thread Tedd Sperling
On May 29, 2012, at 5:06 PM, Paul M Foster wrote: I think a lot of coders try to be kewler than the next 18 guys who are gonna have to look at the code, so they use a lot of compression techniques to reduce LOC. That's not kewl to me. Plus, they're lazy. I'd rather see everything with

Re: [PHP] Function size

2012-05-29 Thread Paul M Foster
On Tue, May 29, 2012 at 11:56:47AM -0400, Tedd Sperling wrote: On May 29, 2012, at 10:20 AM, Stuart Dallas wrote: -snip- Besides, truth is subjective, but then so is everything, including that assertion. -Stuart You reply was longer than my monitor was high so I can't give an

Re: [PHP] Function size

2012-05-29 Thread Robert Cummings
On 12-05-29 07:17 AM, Stuart Dallas wrote: I wasn't going to respond to this thread because I think it's a largely ridiculous topic, but some of the responses have scared me. Sir Cummings (hopefully) sarcastic response about using a 5px font size demonstrated how daft it is to base function

Re: [PHP] Function size

2012-05-25 Thread Tedd Sperling
On May 24, 2012, at 5:01 PM, Ashley Sheridan wrote: On Thu, 2012-05-24 at 15:48 -0500, tamouse mailing lists wrote: On May 23, 2012 9:14 AM, Tedd Sperling t...@sperling.com wrote: H Yes, I think that is *exactly* the criterion-- not a mystery or an emergent thing, really, was a pretty

Re: [PHP] Function size

2012-05-24 Thread Matijn Woudt
On Wed, May 23, 2012 at 10:14 PM, shiplu shiplu@gmail.com wrote: On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt tijn...@gmail.com wrote: I agree that large switch block are not always easy and useful to split, however, writing too much code inside a switch block isn't considered good

RE: [PHP] Function size

2012-05-24 Thread Steven Staples
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

Re: [PHP] Function size

2012-05-24 Thread Jeremiah Dodds
Steven Staples sstap...@mnsi.net writes: 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

Re: [PHP] Function size

2012-05-24 Thread Tedd Sperling
On May 23, 2012, at 3:49 PM, Ashley Sheridan wrote: I'm of the same mind. Generally I'll split a function if I'm reusing more than a couple of lines of code. I only split a large function if it's actually doing several things, if it happens to need 200 lines to perform one 'step' then

Re: [PHP] Function size

2012-05-24 Thread Tedd Sperling
On May 24, 2012, at 8:37 AM, Steven Staples wrote: Tedd, I think the length of code depends on a few different factors, what if you have your docblocks, and comment lines, as well as your bracing style? Where do you consider your function to start? It starts where it starts. It doesn't make

[PHP] Function size

2012-05-23 Thread Tedd Sperling
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

Re: [PHP] Function size

2012-05-23 Thread shiplu
On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@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

Re: [PHP] Function size

2012-05-23 Thread Tedd Sperling
On May 23, 2012, at 11:49 AM, shiplu wrote: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: When number of lines becomes the criteria of function size? Wouldn't it depends on the task the function is doing? You missed the point. Of course, the difficulty of the task of a specific

Re: [PHP] Function size

2012-05-23 Thread Robert Cummings
On 12-05-23 12:15 PM, Tedd Sperling wrote: On May 23, 2012, at 11:49 AM, shiplu wrote: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: When number of lines becomes the criteria of function size? Wouldn't it depends on the task the function is doing? You missed the point. Of

Re: [PHP] Function size

2012-05-23 Thread Matijn Woudt
On Wed, May 23, 2012 at 5:49 PM, shiplu shiplu@gmail.com wrote: On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@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

Re: [PHP] Function size

2012-05-23 Thread Tedd Sperling
On May 23, 2012, at 12:21 PM, Robert Cummings wrote: On 12-05-23 12:15 PM, Tedd Sperling wrote: What I was talking about was that what we can grasp in one view, we can understand better. If the code lies outside of our view, then we understand it less. I can support this claim with numerous

Re: [PHP] Function size

2012-05-23 Thread Ashley Sheridan
On Wed, 2012-05-23 at 20:59 +0200, Matijn Woudt wrote: On Wed, May 23, 2012 at 5:49 PM, shiplu shiplu@gmail.com wrote: On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: A rule of thumb is

Re: [PHP] Function size

2012-05-23 Thread Matijn Woudt
On Wed, May 23, 2012 at 9:49 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-05-23 at 20:59 +0200, Matijn Woudt wrote: On Wed, May 23, 2012 at 5:49 PM, shiplu shiplu@gmail.com wrote: On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com wrote: Hi gang:

Re: [PHP] Function size

2012-05-23 Thread shiplu
On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt tijn...@gmail.com wrote: I agree that large switch block are not always easy and useful to split, however, writing too much code inside a switch block isn't considered good practice too IMO. Though, it is unavoidable in some cases I think. I do

Re: [PHP] Function size

2012-05-23 Thread Camilo Sperberg
I use a lot of switches but they are always small in size because they look mostly like this: switch($action) { case 'hello': $someObject-executeAction(); break; case 'world': $someOtherObject-executeOtherAction(); break; default: $this-anotherAction(); break; }

Re: [PHP] Function size

2012-05-23 Thread Jeremiah Dodds
Tedd Sperling t...@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