Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: CGI::Application, inheritance trees, and 'the right way'

by FoxtrotUniform (Prior)
on Nov 01, 2004 at 22:44 UTC ( #404446=note: print w/replies, xml ) Need Help??


in reply to CGI::Application, inheritance trees, and 'the right way'

It sounds like SiteManager.pm is a repository for utility code. If that's the case, then it shouldn't inherit from CGI::Application. Going by the names you have, it sounds like EventManager and EmailManager aren't really kinds of SiteManagers; maybe all three are Managers. Inheritance should model "is-a" — if the child class doesn't quite fit, don't force it. That way lies madness.

Don't inherit from a superclass just for code reuse: there are plenty of good ways to reuse code; inheritance is one, but building libraries with clean interfaces is perfectly good, too, and doesn't complicate your life with weird dispatch semantics. If you have to ask "Should foo really subclass bar?", the answer is probably no.

--
Yours in pedantry,
F o x t r o t U n i f o r m

"Anything you put in comments is not tested and easily goes out of date." -- tye

  • Comment on Re: CGI::Application, inheritance trees, and 'the right way'

Replies are listed 'Best First'.
Re^2: CGI::Application, inheritance trees, and 'the right way'
by geektron (Curate) on Nov 02, 2004 at 07:23 UTC
    well, the big reason i have SiteManager as a parent class is because the authentication lives there, and it's really simple auth.

    other functions are utility functions.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://404446]
help
Chatterbox?
[Corion]: Discipulus: Ah, so he's the one getting almost drowned all the time - waterpolo certainly is no sport for me ;)
[karlgoethebier]: Corion: buy enough coke and popcorn...
[marto]: Corion the cinema is a lot more expensive than I remember :P
Discipulus hates the smell of popcorn at cinemas..
[Corion]: marto: Yeah, most of the time, I prefer to watch stuff at home, where we can sit on the couch, order pizza and pause the movie. But for kids,...
[Corion]: ... I think the "cinema experience" is something of its own. But certainly, bringing an USB stick home is much easier ;-D

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2017-07-24 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (348 votes). Check out past polls.