|more useful options|
Naming of modules that are mean to be inherited only?by leocharre (Priest)
|on Aug 09, 2007 at 20:48 UTC||Need Help??|
leocharre has asked for the
wisdom of the Perl Monks concerning the following question:
Warning. This post is about naming modules. If you think having a discussion about namespace is second class devel work, or simply a waste of time, don't bother reading me.
For the rest of you who also have previous experience having to deal with someone else's demented code- and would be too guilty to do that to someone else in turn- Good Karma to you, bless your classy self.
I tend to separate code into various modules if things get large. I can get around vi pretty alright, but I get feel safe with under 500 lines of code per module.
I have a few projects that are large-ish. They comprise of various scripts, tests, modules.. etc..
For example I have a DMS, a document management system- which we use in an office environment.
I have a DMS module, which abstracts the concept of many users, projects, etc. This is an oo module that can be instanced, tested, etc stand alone.
I also try to organize my code and docs so I don't lose my freaking mind. So I have other modules like
DMS::Setup (aid with installation, check current machine's installation) and maybe DMS::Database, DMS::Configuration... etc
So, since these modules are there for organization's sake, since, they are always used inherited (use base..)- I was considering naming these something like DMS::_Setup, DMS::_Database, so any module names that start with an underscore can be assumed to be inherited.
I want to know if this sounds good. I also would like to know if in your experiences, separating the code up is indeed good, at what line count do you feel good about doing that- and do you have other ways of dealing with this other then to just put a big warning in the description that says 'dont use me' ?
(What about putting all private methods in external modules, and all public methods in main object? It sounds good, but I fear it would be hairy to maintain?)