Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4293

Re: Composition instead of inheritance

References <mailman.946.1304010200.9059.python-list@python.org> <d34a5410-42a1-44f6-91b4-32853ae55aca@glegroupsg2000goo.googlegroups.com>
Date 2011-04-28 20:58 -0700
Subject Re: Composition instead of inheritance
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.981.1304049540.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Apr 28, 2011 at 3:35 PM, Carl Banks <pavlovevidence@gmail.com> wrote:
> On Thursday, April 28, 2011 10:15:02 AM UTC-7, Ethan Furman wrote:
>> For anybody interested in composition instead of multiple inheritance, I
>> have posted this recipe on ActiveState (for python 2.6/7, not 3.x):
>>
>> http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/
>>
>> Comments welcome!
>
> That's not what we mean by composition.  Composition is when one object calls upon another object that it owns to implement some of its behavior.  Often used to model a part/whole relationship, hence the name.

It's a pretty old idea, that seems to be getting revived in a big way
all of a sudden.  Perhaps the Java people just rediscovered it?

In a Software Engineering class using Ada, the teacher called it
"Structural Inclusion", and of course it was an important concept in
Ada, because Ada had no inheritance.  This was in 1989-1990.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Composition instead of inheritance Carl Banks <pavlovevidence@gmail.com> - 2011-04-28 15:35 -0700
  Re: Composition instead of inheritance Ethan Furman <ethan@stoneleaf.us> - 2011-04-28 18:43 -0700
    Re: Composition instead of inheritance Ben Finney <ben+python@benfinney.id.au> - 2011-04-29 13:44 +1000
      Re: Composition instead of inheritance Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-04-29 11:23 +0200
  Re: Composition instead of inheritance MRAB <python@mrabarnett.plus.com> - 2011-04-29 03:14 +0100
  Re: Composition instead of inheritance James Mills <prologic@shortcircuit.net.au> - 2011-04-29 13:16 +1000
  Re: Composition instead of inheritance Dan Stromberg <drsalists@gmail.com> - 2011-04-28 20:58 -0700
    Re: Composition instead of inheritance Ben Finney <ben+python@benfinney.id.au> - 2011-04-29 14:14 +1000
  Re: Composition instead of inheritance John Nagle <nagle@animats.com> - 2011-04-28 22:10 -0700
  Re: Composition instead of inheritance Ethan Furman <ethan@stoneleaf.us> - 2011-04-29 13:39 -0700

csiph-web