Programming Style

PaulS:
My opinion is that if a function takes up more than one screen, it is doing too much.

An excellent observation and an excellent rule of thumb.

Years ago I read an article in Communications of the ACM about the optimal function size. The researchers determined that the optimal size was approximately 25 lines with a dramatic decrease in quality after 25 lines. At the time, most displays supported 25 lines of text so they theorized that screen size was a good measure of optimal function size.

Sometime later another researcher followed-up on the idea. That time around the optimal size was determined to be approximately 43 lines. What changed? Better development tools? Smarter programmers? No. Display resolution had increased.

Obviously, that is not a hard-fast rule. There are situations where a long stretch of discrete steps works best as a single block of code.