-
Notifications
You must be signed in to change notification settings - Fork 308
Factor out a package.team mixin #4422
Factor out a package.team mixin #4422
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the advantage of this Team mixin?
""" | ||
return cursor.one( 'SELECT t.*::teams FROM teams t WHERE t.id=' | ||
'(SELECT team_id FROM teams_to_packages tp WHERE tp.package_id=%s)' | ||
, (self.id,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be my recent lack of exposure to Python mixin classes, but this actually feels a bit backward. You mix it in with Package, but instead of Package leveraging some of the functionality of the mixed-in Team, Team leverages things like self.id
that must be in Package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's consumers that leverage the synergies contained herein, not necessarily the main Package object itself. The goal here is to keep files reasonably sized (well under 1,000 lines ideally), and the architecture is to have a main Package class (e.g.) that is essentially a container, with API provided by these mixins. But the API itself is called primarily by other objects.
Does that make any sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes sense. It seems like the API of Package is a little more opaque that way. It more hides the complexity due to lines of code (if any) than reduces it. But it's no reason to hold up this PR - just my thoughts on the matter now. ;-)
Part of #4305, follows on #4404.
Minor refactor. Ready for review.