[placement][ptg] code refactoring constraints and goals
> For a variety of reasons, most of which would be obvious given my
> previous enthusiasm for exploring alternatives, Iâ??ve proposed a story
> for refactoring out the DB-specific code from the rest of placement:
> I donâ??t know what everyoneâ??s preference would be for where the DB code
> would go: either in private methods of the original module, or in a
> separate DB module, so I added as the first task coming to a decision
> on how to make that split.
, I noticed something that will make it a bit icky.
Some of the db methods (e.g. ResourceProvider._create_in_db) are true
instance methods: they read and change instance attributes. If we move
forward with the suggested refactor, we could solve this in a couple of
(1) Pass `self` to the db method. This grates on me pretty bad. It
screams that the thing should be an instance method.
(2) Pass in the attributes that are needed by the method, and return the
ones that the caller needs to use to update itself. This may make for
some ugly call/return signatures.
IMO (2) is the lesser evil.