in reply to Is there an ideal module size or subroutine size?

With regards to the size of individual subroutines, I read somewhere a while back (and it may have been in PBP), that "if any subroutine takes up more than a single screen when viewed in your editor - then it is probably too big".

Personally, I like that - and I try to use it as a general rule of thumb.

Cheers,
Darren :)

  • Comment on Re: Is there an ideal module size or subroutine size?

Replies are listed 'Best First'.
Re^2: Is there an ideal module size or subroutine size?
by Fletch (Bishop) on Aug 14, 2007 at 15:54 UTC

    (Hopefully not showing my age too much, but) I originally heard that n years ago as "more than a single page" when printed, but the sentiment survives. If a sub is spread over more than a single "contextual unit" (printed page, screen full) you start to spend more time trying to track where you are in the big picture rather than following the flow of the logic.

    (Of course when you run a 1280x1024 monitor rotated to portrait orientation "a single screen" can get pretty long . . . :)

Re^2: Is there an ideal module size or subroutine size?
by syphilis (Archbishop) on Aug 15, 2007 at 12:12 UTC
    if any subroutine takes up more than a single screen when viewed in your editor - then it is probably too big

    For mine ... if any subroutine takes up more than a single screen when viewed in your editor - then you probably need a different editor, or a bigger screen ;-)

    Cheers,
    Rob