Program to an interface, not an implementation

Egbert Bouwman egbert at bork.demon.nl
Mon Jun 10 12:19:52 CEST 2002


Again I learned a lot from both of you, and reading a couple of hours 
in a C++ book helped as well. But it is not all crystal clear any more. 

Eric says:
> So, as you see, you probably can live without knowing anything about all 
> this and still be able to do great stuff with whatever language you like 

You should see my programs already. However I have the impression that 
assimilating the GoF book will improve things enormously. And for that
I have to understand their and other terminology. 
Compared to the terminologies the basic mechanisms look simple.

In Gordon's reply the venom is in the end:
> For C++ interface inheritance REQUIRES class inheritance.  For
> Python/Smalltalk, it does not.

This I read as:
For Python interface_inheritance does not require class_inheritance.

So you can inherit an interface without inheriting the class,
but interface_inheritance by way of class_inheritance is possible as well.
That means at least two things:
- python has interface inheritance (which some people deny),
- interface_inheritance without class_inheritance is a kind of cultural 
  (not genetical) inheritance: give it the same name and all is well.
  But for me that is only polymorphism !

I do all this hair splitting because the GoF say (still page 17) 
that many patterns depend on the distinction between interface- and 
implementation inheritance. How do you define in python the
interface inheritance the GoF talk about ?
egbert
-- 
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
========================================================================





More information about the Python-list mailing list