Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^4: Conditional inheritance strategy

by JavaFan (Canon)
on Oct 27, 2010 at 16:27 UTC ( #867776=note: print w/replies, xml ) Need Help??

in reply to Re^3: Conditional inheritance strategy
in thread Conditional inheritance strategy

If nothing else, having the initialisation class in the inheritance tree via @ISA, is baggage, if there are no other methods than _init().
Well, calling two one element arrays "baggage" is stretching the meaning of "baggage". But even so, it's not baggage attached to any instance of the class. Just the classes themselves.
Looking back at the OPs code, there seems to be little reason for calling the _init() routines as methods rather than subroutines.
Hmm, yeah, but that seems to be true of at least 95% of OO code written. I'm not the worlds biggest OO fan, but if I were to do something like the OP, I'd use 3 classes as well, with two classes having just an init method (but with the inheritance tree as showed elsewhere in the thread).
Indeed, as no instance of the initialisation classes is ever instantiated, it could equally be termed "poor OO".
Really? You only use inheritance if you instantiate every class of your inheritance tree? (Or do you write "poor OO" code?)
If the idea is simple to provide two methods of initialisation, better I would say to have them both in the main My package space called (say) _initFromXML() and _initFromJSON() and ditch the extra package spaces entirely.
While certainly possible, it's not something I would do.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://867776]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2020-12-03 01:39 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (49 votes). Check out past polls.