Remember this is a generic disscussion about inheritence, not bound to the exact laws of programming languages, so although multiple inheritence is not currently a part of my study, I am not convinced it should be shunned entirely as it is in the programming world (which really, like GOTO's...are only hazardess in inexperienced hands IMHO).
I'm not sure how to even start this disscussion, as details are all pretty vague as is my understanding. The desire to study such a model stems from the fact that, the best way to increase programmer productivity is to re-use code. One proven method for doing so, is inheritence and possibly composition, which for the sake of this disscussion, we shall assume are analogous to each other.
Again, I want to reiterate, that this is not bound to the same policies that make up good software design. So avoid the desire to draw on examples of good OOP practice if possible.
Here is essentially the problem I am faced with in conceptualizing my pusedo-langauge and it's inheritence model.
I have an object, which is derived from another object. The child object assumes everything of it's parent. Now assume there is a property in the parent which does not strictly apply to all or any children. Is it best to define that property as "private" in the parent class or indicate that it is not to be inherited inside the child class, as it's possible other children will want that property.
Can you foresee any design flaws (thinking abstract or generically) with supprting a bi-directional inheritence paradigm?
Inheritence, in the context of programming languages is typically dictated by the parent class. That is, if a property is set to "private" no derived children will inherit (directly) that property and any duplicate property defined/declared in the child class will simply exist without being any wiser that it was already defined in the parent class.
What is the purpose of this bi-directional model, you may ask? I'm not sure, just keeping my options open as this whole idea is still concept or abstract thinking on my behalf. In the application I plan on implementing this idea, I think could benefit from bi-directional inheritence, or maybe not. Thats what I'm trying to determine.
Programming languages support this functionality, sorta, with method overloading/overriding. If there is a function in a child class which you inherit but know you will never use or want, you can simply redeclare as private or override it and return NULL or similar technique. I am not dealing with functions so method overloading doesn't apply, which is why I have this question in regards to bi-directional inheritence.
I have also found myself asking the question about supprting what i would call deep inheritence. Consider the following example:
Code: Select all
Object A
Object B : Object A
Object C : Object BHere is the caveat. Property in Object A is inherited by property in Object B but declared as private, so...
Object C does not inherit property in Object B, however it does inherit the same property from Object A. Follow me?
Using a deep inheritence model when you derive Object C from B from A, Object C has all the same properties (updated and changed as required by each object in the hierarchy). However is Object B indicates it's property is private (no inheriting) then Object C would actually only inherit the property of Object A. This would allow some interesting (quite possibly chaotic inheritence trees).
Can you think of any design flaws which could potentially be introduced following this method of inheritence (thinking abstract not programmatically - remember same rules don't apply)?
If you think, I think to much! Then I think, your correct in thinking that.
Seriously though, if this is of no interest to you and your not interested in thinking outside of the box and insist that current programming models have it right, then don't reply.
This is not a disscussion to discover new model of programming inheritence. I am simply observing generic inheritence models (could be programming objects, could be atoms, could be whatever, again abstract thinking) and would like the opinion of a few open minded individuals whom I know at least have an interest in how and why inheritence works the way it does.
Having started this disscussion with a biology prof. (many moons ago) yielded frustrating results, as to him, everything stemmed from a dual-parent inheritence, lineage is always that simple. Programming langauges (usually) dumb it down by allowing only a single parent inheritence model (except languages like C++ which allow multiple inheritence; 2 or more parents). I'm not sure what I am investigating, perhaps multiple inheritence or somethin more taboo, like incest. Where your brother is also you grand father.
p.s-I realize as developers we are programmed (no pun intended) to think a certain way about the world, so if you need to draw on programming examples to assist in explaining yourself, feel free. Such as hilighting potential problems in bi-directional inheritence models or the latter problem I have described. Just try and make it abstract.
Waiting for some interesting replies.