openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #06149
Re: using objects returned from DB layer
On Thu, 2011-12-15 at 07:10 +0000, Chris Behrens wrote:
> There's a mix of usage throughout the code, and I know some people are
> just matching the surrounding code. But, in a number of cases, I've
> asked for these to be corrected to the latter, on assumption that the
> DB layer will be returning dictionaries at some point vs the models.
> It also pushes the code towards consistent usage. But I might be the
> only Nova Core member looking at this and/or maybe my assumption is
> wrong.
>
> So, I ask here: Should Nova Core make an effort to reject patches
> with the former format? Or did I miss any DB layer plans where the
> former format is now preferred?
I have two, diametrically opposed answers.
1. When doing reviews, I've generally tried to enforce the dict
access format, because it's been my understanding that that is
the direction we're going in.
2. However, I violently disagree with the idea that the DB layer
must return dicts. It does not, even if you start talking about
allowing use of other kinds of databases. We can, and should,
wrap these things in objects, upon which we can call methods
that do things—i.e., we should, you know, actually use
object-oriented programming.
--
Kevin L. Mitchell <kevin.mitchell@xxxxxxxxxxxxx>
Follow ups
References