Re: Strategic Functional Migration and Multiple Inheritance
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Tue, 13 Jun 2006 20:39:48 +0100
Shawnk <Shawnk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
In answer to some of your excellent points..
I'll only answer a few of your answers, again due to time I'm afraid.
I'm afraid I really don't see the relation between the two - it's like
claiming that object orientation is fundamentally linked to Turing
machines, IMO.
In a non-single CPU design an argument (against MI, etc) can be
made by saying each class would have its own processor. The
intent (of the statement) was to focus the context (of MI use)
and re-enforce the 'scientific metric' point about physical phenomena
in the context of a 'Turing machine'.
That seems like a very odd analogy, I'm afraid - I can't see how it
provides any benefit.
I found your analogy a bit arrogant -
Cringe. Those who don't know me tend to see that while those that do
see me as having a casual 'matter of fact' attitude coupled with a
strong passion for truth, justice and the American way :-)
(... I just could not resist. PS. American way is to question
your superiors .. in this case Anders' approach to language expression
in C#).
A matter of fact attitude is fine when we're talking about matters of
fact. I'm often viewed as arrogant on those issues as well - issues
where one can point to a spec and *prove* correctness. This is a matter
of *opinion* however, which is very different.
For what it's worth, my main beef with MI is that however you choose to
solve the "diamond of death", you've added complexity.
I qualified the 'diamond of death' issue as an 'under the cover' issue to
decouple (for these posts and thread) what the compiler generates from what
the programmer writes.
As I've said elsewhere, it's *not* an implementation issue. The effect
would have to be covered by the language specification.
Complexity being measured (a la information theory) as a simple character
count of the MI/SI expression alternatives.
I have to say, I think that's a very silly way of measuring complexity.
Would C# be a "simpler" language by making all the keywords single
letters? I don't believe so. It *certainly* wouldn't be a more readable
language.
The complexity I'm talking about is how hard it is to think about the
object model, and I believe that MI makes the model more potentially
complicated.
Whenever you make code harder to read, the upside has to be big. Considering...
two or more base classes *is* a more complex situation, naturally making the
thought processes harder, IMO.
And I would normally favour composition/aggregation in such cases,
rather than repeated code.
This is exactly what I was searching for in this thread. A clear
concise and focused articulation of the conceptual comparison of
MI and proposed alternatives. (From someone who I respect :-)
[1] Composition
[2] Aggregation
In [2], functional agregation can be accomplished via MI or by embedding a
class
within a class. Both (MI, embedding) are agregation mechanisms. To clarify
your meaning - Did you mean - for example ...-
In creating a functional unit (class) Fu (in C#) that needs functionality from
classes Fx, Fy, Fz (three classes) you would inherit from either Fx, Fy or Fz
and embed the other two classes?
No. I would implement Ix, Iy and Iz by delegating each of the
implementations to an instance of each of Fx, Fy and Fz. Those
instances may be created by the class or specified externally (giving
flexibility). When writing Java in Eclipse, this is even supported very
simply by the IDE itself. It would be nice if there was a way of
expressing it in the language itself, but that wouldn't be equivalent
to MI.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- References:
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Shawnk
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Radek Cerny
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Shawnk
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Radek Cerny
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Jon Skeet [C# MVP]
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Shawnk
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Jon Skeet [C# MVP]
- Re: Strategic Functional Migration and Multiple Inheritance
- From: Shawnk
- Re: Strategic Functional Migration and Multiple Inheritance
- Prev by Date: Re: Strategic Functional Migration and Multiple Inheritance
- Next by Date: RE: Strategic Functional Migration and Multiple Inheritance
- Previous by thread: Re: Strategic Functional Migration and Multiple Inheritance
- Next by thread: Re: Strategic Functional Migration and Multiple Inheritance
- Index(es):
Relevant Pages
|