[openstack-dev] [Solum] Some initial code copying for db/migration

Dan Smith dms at danplanet.com
Mon Nov 18 21:00:55 UTC 2013

Sorry for the delay in responding to this...

>   * Moved the _obj_classes registry magic out of ObjectMetaClass and into 
>     its own method for easier use.  Since this is a subclass based implementation,
>     having a separate method feels more appropriate for a factory/registry
>     pattern.

This is actually how I had it in my initial design because I like
explicit registration. We went off on this MetaClass tangent, which buys
us certain things, but which also makes certain things quite difficult.

Pros for metaclass approach:
 - Avoids having to decorate things (meh)
 - Automatic to the point of not being able to create an object type
   without registering it even if you wanted to

Cons for metaclass approach:
 - Maybe a bit too magical
 - Can make testing hard (see where we save/restore the registry
   between each test)
 - I think it might make subclass implementations harder
 - Definitely more complicated to understand

Chris much preferred the metaclass approach, so I'm including him here.
He had some reasoning that won out in the original discussion, although
I don't really remember what that was.


More information about the OpenStack-dev mailing list