[placement][ptg] code refactoring constraints and goals
On Apr 11, 2019, at 12:07 PM, Eric Fried <openstack at fried.cc> wrote:
> (1) Pass `self` to the db method. This grates on me pretty bad. It
> screams that the thing should be an instance method.
That is actually a pretty old design pattern: passing a data object, rather than a slew of parameters. Of course, it would be cleaner to keep them as instance methods, and that would be my preference. I know that you have expressed an interest in reducing the overall size of the individual modules, so this option is only valid if smaller modules is decided on as a Good Thingâ?¢,
> (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.
I canâ??t think of a more brittle approach.
-- Ed Leafe