Re: delegation vs. inheritance
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Thu, 10 Aug 2006 06:52:31 -0700
On 10 Aug 2006 02:26:27 -0700, Thomas Kowalski wrote:
Hi Dmitry, Steven,
maybe I didn't understood exactly what your discussion is about, but
IMHO the word inheritance is not choosen well. The paradigma
inheritance describes the s/w industrie is simply specialization.
Not necessary. Inheritance is just a way to define a relationship between
two types. Specialization is a specific property of that relationship.
Generalization is another. But the most common case is neither
specialization nor generalization.
Every time we define an objects we are adding constraints. Each
methode, each member constraints this class to an actually usable
"item". Since we say an square is a special rectangle, it would be
perfectly fine too have it "inheriting" is this direction, as you
stated already.
For in-methods, yes. But out- and inout-methods will be broken. Results are
outs.
In fact, you can inherit rectangle from square or square from rectangle,
that changes little.
The Idea of breaking the "contract" with is implied by the constraints
made by a certain class might be a neat feature in some situations, but
is most of the time not neccessary and would just complicate the whole
typesystem.
The problem is that you cannot get a new type without breaking something. A
thing exposing same behavior is just the same thing. It walks like a duck
it quacks like a duck, it is a duck.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.
- References:
- delegation vs. inheritance
- From: Thomas Kowalski
- Re: delegation vs. inheritance
- From: H. S. Lahman
- Re: delegation vs. inheritance
- From: Rick Elbers
- Re: delegation vs. inheritance
- From: H. S. Lahman
- Re: delegation vs. inheritance
- From: Dmitry A. Kazakov
- Re: delegation vs. inheritance
- From: Rick Elbers
- Re: delegation vs. inheritance
- From: Dmitry A. Kazakov
- Re: delegation vs. inheritance
- From: S Perryman
- Re: delegation vs. inheritance
- From: Dmitry A. Kazakov
- Re: delegation vs. inheritance
- From: S Perryman
- Re: delegation vs. inheritance
- From: Thomas Kowalski
- delegation vs. inheritance
- Prev by Date: Re: Glue Interface
- Next by Date: Re: Helper Methods
- Previous by thread: Re: delegation vs. inheritance
- Next by thread: Re: delegation vs. inheritance
- Index(es):
Relevant Pages
|