in reply to One Big Script v. Several Small Scripts

I would tend to modularize this sort of script at least to the extent of using subroutine calls within each of the major "mode" blocks, so that the overall scope of mode choices is presented compactly and clearly in the "main".

Whether the mode-specific subs are stored in separate source code files may be a question of optimizing load time, or may just be a matter of stylistic preference, but in any case, the path to writing code that is minimal, optimal and easy to re-use begins with proper factoring, and factoring is mostly a matter of decomposing and organizing the program logic into functional (or methodical) blocks -- i.e. subroutines.

(Officianados of OO would probably phrase it differently, but the overall thrust of the idea would be equivalent, I think.)

  • Comment on Re: One Big Script v. Several Small Scripts