[Tutor] functions--how long is too long?

Lie Ryan lie.1296 at gmail.com
Tue Dec 8 11:27:42 CET 2009


On 12/8/2009 8:27 PM, Alan Gauld wrote:
>
> Remember the old adage that a function should ideally fit on a single
> editor screen (or sheet of printout) - when I started that meant
> 25-60 lines was the range, now you can go up to 60-100 lines if needs be...

I disagree. I keep my text editor not maximized so I can have multiple 
editors open (or multiple splits when using (g)vim); a 100-lines 
function would take the all the screen and doesn't fit in one window. I 
generally would consider something above ~50 lines as very large. A 
large screen is better utilized for multiple windows rather than for 
larger functions.

While you should not refactor just for the sake of keeping line-counts, 
perhaps you should try the small editor approach. Keep your editor 
unmaximized, for around 20 lines, around half a screen.



More information about the Tutor mailing list