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

It's a matter of personal preference, but I have very few subs which are more than about 30 lines in length - that way, they fit on the screen, and the logic is easy to follow. If it is getting too long, I remove a set of lines which together form a single logical unit and put that in a separate sub. The name of the new sub reflects that single piece of logic, and so makes the original code a lot easier to follow.

I have a few modules which are about 1000 lines in length, but these start getting difficult to maintain. Most of my modules are less than 500 lines.

I'm wondering how much repeated code you have in your 3 modules - with a bit of refactoring, you could probably split those modules up, and make more of code reuse. Besides being easier to follow, they'll make maintenance less of a nightmare.

Clint

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