Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Naming of modules that are mean to be inherited only?

by adrianh (Chancellor)
on Aug 12, 2007 at 08:57 UTC ( #632036=note: print w/replies, xml ) Need Help??


in reply to Naming of modules that are mean to be inherited only?

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 These last modules do not do anything by themselves, they are inherited by the DMS object, sometimes by DMS::User, DMS::Client.

As a design point I'd be sort of suspicious if a DBS::User and a DMS::Client had isa relationships to Configuration and Setup classes - seems odd...

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.

When I have abstract classes I usually us a suffix of "Base" so I might have MyApp::Page::Base as the abstract class and MyApp::Page::Search as a concrete class that inherits from MyApp::Page::Base.

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

Line count isn't really the kind of distinction that I use when deciding to cut up code into modules. Instead break up classes around units of behaviour so we get low coupling and high cohesion in the design.

That's what worries me about having those Setup classes as common classes that everything inherits from. Tweaking Setup seems to affect everything in your code - which is probably a bad thing.

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' ?

Personally I don't worry about it. If it's an abstract class I'll document it as one. If it's something private/implementation specific that might change I'll mention that too. If the user uses something that I've told them I might change at a later date that's their problem.

  • Comment on Re: Naming of modules that are mean to be inherited only?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://632036]
help
Chatterbox?
[erix]: my dog could do the classic mouse jump (never caught a mouse :)
[erix]: he caught a hare once (must have been a young one...)
virtualsue uses arcane git commands to resurrect a file, gets it back into shape and quits for the day
[GotToBTru]: a few years ago, when we had 3 dogs, the largest of them caught a chipmunk, but did not know what to do with it other than hold it in his mouth
[GotToBTru]: my wife told him to spit it out, so he did
[erix]: yeah, modern dogs are cute tjhat way :)
[erix]: except of course, the RHODESIAN LION HOUND ! :)
[Discipulus]: in roma cars are good mouser.. fortunnately no mouse at 7th floor..
[GotToBTru]: that's a name that should always be accompanied by a trumper fanfare
[GotToBTru]: trumpet, not trumper

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2017-11-17 20:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?