Re: Meyer(s) gets it wrong

From: Programmer Dude (Chris_at_Sonnack.com)
Date: 02/20/04


Date: Fri, 20 Feb 2004 11:07:08 -0600

Ian Woods wrote:

>> And to monkey wrench my own sense, how about a webserver getting
>> a request for "GET /". Same client, same command, different
>> results.
>
> And, just as importantly, different underlying behaviour. Some
> requests to some servers might involve merely fetching a file,
> or running a CGI/ASP/PHP/<insert TLA here> script.

Yep. But,.... [grin] been thinking about this, and I've decided
(in part to continue as Devil's Advocate, but also in because I
just don't see the OOP sense of polymorphism here) I just don't
see the OOP sense of polymorphism here.

(I'll go into why in detail in my response to Michael.)

>>> So, inheritence:
>>
>> Nah,... now this one I ain't buyin' at all.
>
> I think we might be back on a similar track to an earlier
> discussion we've had, to do with the difference between
> inheriting the underlying implementation of something as
> opposed to the interface of something. :)

Very possibly. I'd like to make clear that, first, in a GENERAL
sense of "polymorphic" (many shapes) and "inherited", I quite
agree with you guys' perceptions. It's the OOP-ish sense of
those concepts I don't feel quite applies. My goal here isn't
to convince anyone of the "truth" of my view--I just think it
might be fun to expose and dicuss the opposing viewpoints. And
hopefully, no one has any emotional attachments here! (-:

Anyway....

> My take on this from the view that OO is 'all about' the interface
> rather than the implementation.

This *is* going to get interesting, because a big part of my reply
to Michael involves the difference between interface ("shape") and
implementation!

> If I take a class A and derive a class B from it, I can specify
> which methods from A are applicable in B and provide additional
> methods of B's very own.

"Specialization". You're making a "more specialized" A.

> From here, other than the quirk that the inherited methods in B's
> interface happen to be duplicates of the behaviour of the same
> method in A (unless told otherwise), all that has been specified
> is how the interface of B relates to the interface of A.

But... without the implementation, all you have is a design, so I'm
not sure we can entirely discount it in defining "inheritance".

I'd quibble over calling the duplication a quirk--it's the whole
point. You can pass a B to something expecting an A, and that
something will "see" it as an A. And it will be, in fact, an A.

After all, inheritance is sometimes named "is-a". I might casually
say I "inherited" a behavior from a friend, but I wouldn't mean it
in the OOP-ish sense, because there's no "is-a" relationship. There
is more a "using", "supports" or "has-a" relationship.

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|


Relevant Pages

  • Re: Inheritance and Polymorhpism (getting back to the point)
    ... > sharing an implementation and sharing an interface - it includes both ... I cannot help the way "inheritance" has become widely accepted ... both implementation and interface, separately or together. ... conformance and allowing polymorphism is "inheritance" and the ...
    (comp.object)
  • Re: whats the point of an interface?
    ... You are correct: inheritance of an interface ... is considered to be a form of polymorphism. ... inheritance acts as "Subtyping polymorphism". ... programmer helping programmers. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: whats the point of an interface?
    ... >> implementation of a single interface. ... > This is inheritance, not polymorphism. ... In object-oriented programming theory, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Inheritance and Polymorhpism (getting back to the point)
    ... >>inheritance, and I'll try to answer the question. ... example of parametric polymorphism and there is no inheritance involved ... In this context I agree with Cozianu that the interface inheritance is ... But if those classes are not related through subclassing, ...
    (comp.object)
  • Re: Tired of 100s of stupid Getter/Setter methods
    ... but interface does not hide the other methods of implementing ... telling you that you need to refactor a new common superclass. ... Again, composition instead of inheritance. ... A StringVector cannot take Integer parameters. ...
    (comp.lang.java.programmer)