Why have a separate package for every file in a project?
A current project's goal is to take two sets of requirements (old and new). Find the best matches between them. Major subtasks are:
- Read the requirements in, sanity check
- Construct complex weighting scheme
- Perform the match
- Print out report tables
I'm putting each of these in a separate file; files run ~350 lines each.
All the tutorials and examples (e.g. perltoot) show a different package for each file (something like RqMatch::InSanity, RqMatch::Weight, RqMatch::Matches, RqMatch::Report). And the modules that I've downloaded from CPAN mostly follow this scheme.
Why? Why not just put them all in a single package? The project isn't large enough for naming collisions to be a problem.
Suppose I use the same package throughout. During development, when I notice that a file has grown large enough to become unwieldy, and has developed two separate themes, I just create a new file and move some of the functions / methods over there. I don't have to do any package-management to my existing files. But if I give the new file its own package, then I have to doublecheck all the places I've invoked those functions. What does it buy me?
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.