Few of my modules get over about 600 lines, and most of them are under 400 lines.
There are several reasons for that:
- I'm often working with fairly simple concepts.
- I let CPAN modules do much of the heavy lifting when I can.
- I use mostly OO these days.I, personally, would rather have more simple objects than fewer complex ones -- as simple as makes sense, but no simpler. I usually break my modules along class lines.
-
- I've found I can reuse modules easier the less they do. That means I'll write a module meant for reuse and another that either wraps or subclasses it for just the initial project if I think most of the module will be useful elsewhere but want to keep a bunch of extra stuff out of it.
- Modularity can save space when reusing code if you don't need everything from one project in another, too.
OTOH, modules which deal with big, monolithic things that are really complex might need to be big, monolithic things that are really complex. A number of CPAN modules have files that are multiple thousands of lines long. MIME::Lite is over 3k lines, IIRC. PDF::API2 has a few files over 30k lines among its supporting modules (all of which appear to be East Asian font sets). PDF::API2::Simple sits at over 1000 lines. DBI.pm is over 7k lines.
One project I've been developing and maintaining for months has a number of modules specific to it. It also has a number of modules reused from other projects. Some of those have been improved and re-reused back into the original projects. There are several modules I'm using from CPAN for this project that are 2000 lines or longer, but none of the ones I've written are more than 1000 lines. That's one of the joys of CPAN. Someone else has done many of the big, hairy modules.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.