More power than needed ... OOP to Don Clugston

BLS lietz at wanadoo.fr
Sat Mar 18 02:24:06 PST 2006


Hi Don,
okay, now I understand what you mean. Takes a while. You may have noticed
<g> that english is not my favourite language.
GoF.
Yes of course, I know about it. I read Bruce Eckel s Thinking in Pattern and
Prof. Moessenboek OOP in Oberon 2 instead because I have heard that GoF
Design Patterns is a bit too theoretical. Can you confirm ? Or will you say
it is a "You need it" book ?
Thanks,
Bjoern


"Don Clugston" <dac at nospam.com.au> schreef in bericht
news:dveppu$1im5$1 at digitaldaemon.com...
> BLS wrote:
> > Hi Don,
> >
> > Don C. wrote :
> > <<In OOP, you spend your time trying to find Is-A relationships, but
they
> > don't exist. Unsurprisingly, hardly anyone is "really" doing OOP. It
> > seems to be unimplementable.>>
> >
> > Oops, what is the matter? . A Is-relation between two classes is just
> > inheritance. f.i. cB inherits cA, ergo cB is a special case of cA.
>
> Yes, that's exactly right. I'm saying that inheritance is rarely
> appropriate. If you read the Design Patterns GoF book, you'll see that
> the #1 rule of OO design is, "Prefer encapsulation to inheritance".
> But the defining feature of OO design is inheritance. Without
> inheritance, OOP doesn't have polymorphism.
>
> What I find extremely common in practice is "Can-be-treated-as-A"
> polymorphic relationships. Most of the time, "is-A" relationships are an
> approximation to "Can-be-treated-as-A" relationships. I think that
> polymorphism is very important, but inheritance-based polymorphism has
> many problems.
>





More information about the Digitalmars-d mailing list