qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH qom-next 1/7] qdev: Push state up to Object


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH qom-next 1/7] qdev: Push state up to Object
Date: Sun, 10 Jun 2012 12:35:37 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 06/10/2012 10:49 AM, Paolo Bonzini wrote:
Il 08/06/2012 03:19, Anthony Liguori ha scritto:

+typedef enum ObjectState {
+    OBJECT_STATE_INITIALIZED = 1,
+    OBJECT_STATE_REALIZED,
+} ObjectState;

I think using a bool would be better since it reduces the temptation to
add additional states.

In fact someone already discussed having a third state for block
devices... :)

This is *exactly* why bool is better. Because too many people will be tempted to add stuff that doesn't belong in Object.

A classic problem with OO design is bloating base classes--especially when you have one common base class.

Everything in Object must be relevant to all subclasses, not just some. Having an OBJECT_STATE_OPENED only makes sense for BlockDevices. Therefore the concept of opened should live in the BlockDevice parent class.

Regards,

Anthony Liguori


Paolo




reply via email to

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