[Tutor] functions--how long is too long?
denis.spir at free.fr
Tue Dec 8 11:17:13 CET 2009
Luke Paireepinart <rabidpoobear at gmail.com> dixit:
> I'd say my personal hard-limit for functions before I start refactoring is
> probably around 150-200 lines. But it's rare that functions get that long
Aside questions of personal style & taste, _I_ could not hold such long funcs. Far too much to manage for my head, about unmaintainable for me.
My common limit is about one editor screen (~ 35 lines), comments included, which reveals not only practicle, but also about what my head is able to cope with at once. And my programming style rather leans toward clarity (--> low code density), meaning that 1 line of a "smart" coder may map to 2 or 3 of mine. An absolute limit would be about 2 screens.
To sum up:
150 lines by luke
* 2 (density)
* 2 (comments)
= 600 lines by myself
... compared to my ~ 50 lines medium limit means Luke is a ~ 12 times smarter coder than I am! ;-)
This is a new evidence that coding efficiency is more a question of coder quality than anything else...
la vita e estrany
More information about the Tutor