Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: Conditional inheritance strategy

by JavaFan (Canon)
on Oct 27, 2010 at 16:27 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found