This is actually a very good comparison between real composition (referencing other objects) and…
Thai Pangsakulyanont

So, what would be a good terminology to differentiate between these two ways of doing inheritance?

I have stumbled upon this really interesting debate.

Regarding your question I think that Jeff M didn’t entirely get the point.

In my opinion the examples that you shown could refer to the Interface Segregation Principle (ISP) from SOLID principles.

  1. ‘designing types after what they are’:

Here designed classes are not following ISP and client is cluttered with interfaces it don’t need (e.g. poop) which results with mentioned earlier Gorilla-Banana problem as a side-effect:

class MurderRobotDog(MurderRobot, Dog):

2. ‘designing types after what they do’:

Here (Barker, Driver, Killer) are applied correct interface segregation, client gets exactly what he require.

class MurderRobotDog(Barker, Driver, Killer):
Like what you read? Give Piotrek Witek a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.