[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] Plan for moving forward with QOM

From: Peter Maydell
Subject: Re: [Qemu-devel] [RFC] Plan for moving forward with QOM
Date: Thu, 15 Sep 2011 15:48:36 +0100

On 15 September 2011 15:33, Paolo Bonzini <address@hidden> wrote:
> I think it's in the eye of a beholder.  Hold a PCI NE2000 and E1000, they're
> clearly both PciDevices, but also they clearly both have PciConnectors.
> Write a driver for a PCI and ISA NE2000, and then they're clearly both
> NE2000, but also they clearly both have an NE2K chip.
> So, I don't find either model to be more or less OO.  It just boils down to
> what you pick as your primary choice for inheritance.  It is true that my
> model will produce a more shallow class hierarchies, but only because IMO
> hardware is more about composition than inheritance; that's why I am indeed
> advocating that relationships be established mostly by composition.

Yes. In particular if you're trying to connect one bit of hardware
to another bit of hardware, you don't care at all about whether
the hardware is-a-Foo or is-a-Bar, you care only whether it has-a
set of connections which semantically and logically match up to
the other end. This suggests to me that the class hierarchy
should be whatever is convenient for internal implementation but
shouldn't be relevant or visible to between-device relationships.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]