Re: Function size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 the way you write your code. If they are then you'll be making decisions for all the wrong reasons.
> 
> As gifted as you are, you missed the point.

I'm don't think I did, but as gifted as you are, I think you missed mine :)

> At no time did I say that anyone should do anything to the number of lines they write.

Quite right, but you did say that your functions have grown in size as the number of lines you can fit on half your monitor height has increased. So on some level you are basing your architectural decisions on that measurement, whether consciously or not.

> Also, at no time did I say anything about "Mental capacity".

Quite right, it was Tony who brought that into it. I apologise for mixing it into my general response but I couldn't let it go unchallenged because it's trying to turn it into a pissing contest which is not good for any developer in the ecosystem.

> My statement was not a recommendation, nor a suggestion, but rather an observation. An observation regarding known limits of human perception and comprehension.
> 
> It is a known fact that we have short term memory limits -- there have been countless studies on this -- I do not want to belabor the point further. Web promotion has rekindled and advanced this interest. Here are a few contemporary books on the subject (they are all a good read):
> 
> 1. "Don't make me think" by Steve Krug
> 2. "Submit Now" by Andrew Clark
> 3. "Neuro Web Design" by Susan Weinschenk
> 4. "!00 Things" by Susan Weinschenk
> 5. "Seductive Interaction Design" by Stephen Anderson
> 6. "Designing with the Mind in Mind" by Jeff Johnson
> 7. "Rocket Surgery Made Easy" by Steve Krug (this is not as important as above, but should be considered LAST)
> 
> The earliest study I have been able to find on human perception and comprehension limits is:
> 
> http://symboldomains.com/sperling.html (his study is there)
> 
> George Sperling laid the basic foundation for this "span of apprehension" (as he called it) and many are continuing the investigation.

I'm familiar with the theories (tho I must admit I hadn't come across that one), and I don't disagree with the general point. As you say there's an abundance of studies that support the idea that we have a limited mental work area. However, I don't think they should factor into decisions about how you organise your code because I see those as extremely subjective. The point I was trying to make (poorly it seems) was that if you follow common software engineering principals, use your common sense and refactor based on the logical way a problem breaks up into pieces, you'll usually end up with the same result.

"So why make the point?" I hear you ask… I think the motivation behind architectural decisions, whether macro or micro, is fundamental. Making those decisions because you can see it all on your screen, or hold it all in your head, or any other "I can do this therefore" reason has great potential for resulting in code that's difficult for anyone but you to maintain.

Let's say you're working on a text-only terminal. Your functions (or groups of logic to be more accurate) are likely to fit within 24 lines. Then you take on a project that's been developed by someone using a 30" monitor in portrait. She can see far more lines at once than you can. In fact she can see lines from multiple files at once. If their code structure has been determined by arbitrary, personal preferences such as how much they can see on the screen at once, their code will be a maintenance nightmare, especially for you on your 24-line terminal.

That was the only point I was trying to make. Your observation is not wrong; it makes a lot of sense. However, I don't believe it should be given any further consideration than noting the observation, and you may want to consider what that observation means as far as the overall structure of your code.

In essence you are writing more complex functions, "because you can" which I think is a very dangerous road to be on.

> As for the rest of your post, but of course, you are correct as you always are. You just missed the point that you are human and thus are subject to the same physical limits as the rest of us. Of course, you are free to think otherwise, but knowing you, the truth will eventually win out. :-)

I am human, but we appear to see our limits differently. I see my limits as "I'm fallible therefore the simpler I can make my code the more likely it is to behave the way I want, regardless of what level of complexity with which I think I'm capable of working" whereas you see it in a similar way to Tony, where your limits are based on how much you can see at any one time. I'm not saying there's a right answer, just putting forth my philosophy.

Besides, truth is subjective, but then so is everything, including that assertion.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux