|There's more than one way to do things|
perspective and object-disorientationby Ctrl-z (Friar)
|on Jan 17, 2003 at 22:59 UTC||Need Help??|
forgive me monks, for i have sinned. This is my first confession
And what have you done my son?
I have impure thoughts on altering @ISA during runtime. Often.
Disclaimer: I am a newbie, to Perl and OOP - and largely dont understand the underlying concepts of how Perl works. I apologise if I cant provide a more informed case. This is what Im looking to get from posting this meditation.
So, as I understand it the @ISA is a bit of a hack onto Perl and possibly a conceptual faux pas in regard to "purer" OO languages. Using base.pm seems to be preferred to having the programmer directly manipulate @ISA, though of course, thats pretty much what base.pm does. I wonder that maybe this transparency is not a good thing, and that having a regular array of inheritence is a boon as oppose to a cheap trick.
Consider the obligitary Employee class. An Employee isa Person isa Mammal isa...
Of course, an Employee may also be a Musician, Artist, Trainspotter (in their spare time), or a Father, Husband, Buddy, or a Jerk, Hero, Nondescript-Bystander. There is no little tree diagram that can display this, because largely it is a matter of perspective. Once you have the perspective of the "viewer" (perhaps the user, or another object) then the tree of inheritence can organise itself. Its not the One True Tree of the Employee class - its just a perspective.
I dont yet subscribe to the "everything is an Object" type philosophy, but I can appreciate the power in thinking that way, and am enjoying the challenges of learning the methodology. However, most OO languages expect an objects lineage to be preordained by the God programmer with respect to whatever system he is working on. The fact an Employee isa Trainspotter is of little relevence to a Payroll program, and so in somewhat contrived ecosystems, there is no problem.
But what of other domains like AI, Neural Networks, Bioinformatics, Distributed computing, Peer-to-Peer?. The latter is more where my interest lies, and I often find that a clear line of relationship cannot be predefined. Sure, once there is a relationship you can make pretty tree diagrams, but that is again, based on perspective.
I am not a professional programmer or formally trained. I think of Perl more as an intillectual game than a tool for parsing log files. This is why I love Perlmonks - theres loads of theory up for grabs.
So, theorhetically, is manipulating an objects inheritence based on how it is currently being percieved, a worthwhile cause for meditation?
maybe there is somewhere I can read up on stuff like this?
Thankyou for any time