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