Re: Object-relational impedence

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Mon, 10 Mar 2008 20:05:55 -0500
Message-ID: <2008031020055529560-unclebob_at_objectmentorcom>


On 2008-03-08 21:39:37 -0600, JOG <jog_at_cs.nott.ac.uk> said:

> On Mar 9, 2:23 am, Robert Martin <uncle..._at_objectmentor.com> wrote:

>> On 2008-03-06 06:37:19 -0600, JOG <j..._at_cs.nott.ac.uk> said:
>> 
>>> On Mar 6, 6:26 am, Robert Martin <uncle..._at_objectmentor.com> wrote:
>>>> That's not inferrence.
>> 
>>> Well that all jolly-well looks like inference to me.
>> 
>> I agree that you can infer what elements a subclass has by knowing the
>> elements of the base class.

>
> Well then you have conceded defeat, given our conversation has gone as
> follows:
>
> jog: "So why not treat all 'inheritance' in this way [as inference]?"
> Robert: "Because all inheritance is not about inference."
> jog: show me an example when it is not.
> Robert: I'll ignore that, and just describe the OO mechanism again.
> jog: Look, here is how everything you have listed could have been
> described through inference
> Robert: Ok, I agree that all inheritance can be described via
> inference.

Here's the starting point of the conversation. You wrote:

>> Name(x, Aristotle) -> Species(x, Man)
>> Species(x, Man) -> Mortality(x, Mortal)
>> |= Name(x, Aristotle) -> Mortalilty(x, Mortal)

>
>> No types or reification in sight. Instead I had two groups of
>> statements:
>> People = {Name, Species, Bday}
>> Entities = {Species, Mortality}

>
>> A join of the two statements gave me the inference I required: {Name,
>> Mortality}. All of a sudden it seemed simple. So some questions:

>
>> 1) So why not treat all 'inheritance' in this way?
>> 2) Could one extend to include 'behaviour' as well?
>> 3) And is this a crazy thing to suggest in a cross post to an OO
>> group?


I responded to your first question that when you need to make inferences, an inference engine is a good tool. Inheritance is not an inference engine. And you challenged me:

>> Interesting story.  Yes, when you have a problem of inference, it's
>> good to use an inference engine.
>> 
>>> So some questions:
>> 
>>> 1) So why not treat all 'inheritance' in this way?
>> 
>> Because all inheritance is not about inference.

>
> Hmmm. Then might you give an example of a situation where inheritance
> cannot be described in terms of inference?

To which I described what inheritance is:

> Inheritance is simply the redeclaration of functions and variables in a
> subscope. That's not inferrence.

To which you said "subscope" was a nonsense word, and we had to define our terms. (sigh).

Then you said:

> Well that all jolly-well looks like inference to me.

And I said ... well you can read it above.

> I guess we are done, your objection having been overcome.

JOG, you're original question was: Why not treat all inheritance as the kind of inferrence you get from a database join.

Answer: Because inheritance is not inference. Inheritance is the redeclaration of variables and functions in a subscope.

> I think because of your OO focus you haven't
> recognized that (in this case) there is a danger of putting the cart
> before the horse. Logic first, mechanism second, not t'other way
> around.

On the contrary, your initial question was:

Why can't the mechanism be treated like the logic.

My answer was: because it's a mechanism.

So it seems to me that you are the one with the problem discerning the difference between logic and mechanisms.

Now, I understand your original point. You were trying to use inheritance as a way to make an inference, and then later found that a database join was a better approach. Good! Inference engines are usually better at making inferences than redeclaration mechanisms. But the conclusion you apparently drew from this is that there was something wrong with the mechanism (inheritance) and that it should be more like a database join. That's rather like pounding a nail with a screwdriver and then wishing it was more like a hammer.

-- 
Robert C. Martin (Uncle Bob)  | email: unclebob_at_objectmentor.com
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716                  |
Received on Tue Mar 11 2008 - 02:05:55 CET

Original text of this message