perlquestion
leocharre
<p>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.</p>
<p>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.</p>
<p>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.<br>
I am concerned that I could be making it more obvious to others, and to
myself- which modules are meant to be used directly, and which to be used indirectly (they are inherited).
Briefly put, I was thinking of prepending the module name with an udnerscore.</p>
<p>I have a few projects that are large-ish. They comprise of various scripts, tests, modules.. etc..</p>
<p>For example I have a DMS, a document management system- which we use in an office environment.</p>
<p>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.<br>
I have a DMS::Client module, which represents a client project's information, etc. This is also an oo module that can be tested, instanced, by itself.</p>
<p>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<br>
These last modules do not do anything by themselves, they are inherited by the DMS object, sometimes by DMS::User, DMS::Client.</p>
<p>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.</p>
<p>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' ?</p>
<p>(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?)</p>