loris has asked for the wisdom of the Perl Monks concerning the following question:

Dear Multifilemodulemaking Monks,

Are there any general guidelines for how to strucure a module which may potentially contain several files? I can see that if the main funtionality requires several small classes, these could go in a subdirectory. However, the requirements I have are vague and evolving, so that what I am currently working on may well turn out to be a subordinate class for some yet-to-be-developed, all-singing and all-dancing uebermodule.

Of course it is not really a problem if the above occurs, as I will only have to rename the packages and move the corresponding files around. However, the files are all in a version control system, which makes it a minor hassle. Have I already said that I am lazy?

All enlightenment gratefully accepted.

loris

Replies are listed 'Best First'.
Re: Designing Multifile Modules
by BrowserUk (Patriarch) on Jun 02, 2005 at 11:21 UTC

    One thing that may help you is to realise that there is nothing that say that Some::Module::A has to have any specific relationship to Some::Module or Some::Module::B. Any one of these could be a parent, sibling or child, or completely unrelated to either of the other two.

    Whilst it can be helpful to have the naming and directory structures reflect the hierarchy of classes, it can introduce some inconvenience also.

    A possible approach to the problem would be to name your classes something along the lines of

    Our::ProjectA::Doobries Our::ProjectA::Thingumajigs Our::ProjectA::Wotsits Our::ProjectB::These Our::ProjectB::Those Our::ProjectB::AndThemToo

    Ie. Just stick with a flat namespace within the project regardless of the class hierarchy.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
Re: Designing Multifile Modules
by Joost (Canon) on Jun 02, 2005 at 10:43 UTC

      Yes, I have heard that Subversion has some nice features regarding the renaming of files. However, unfortunately I am stuck with ClearCase, which is less helpful in this respect.

      loris