Open miped opened 10 years ago
Mixins dont just denote shared functionality; they also provide a means of keeping the models "fat" and not "obese". As well as allowing packaging of functionality in semantically and logically grouped, testable objects.
If it becomes shared then the name changes to "CommentsMixin" or "DataCommentsMixin"
It's not testable in isolation though, since it depends on being mixed into something that contains a data
attribute that's a dict. Just seems like a level of indirection for no particular gain.
i disagree re gain. models get large this is a technique that works really well fro keeping them small and simple to understand there is 0 indirection; its just inheritance nothing new there.
re testability not entirely true. you will notice the methods all make use of the .get(key, default) pattern and the data can be either mocked or tested by inference
class MyTestClass(VdeoCommentsMixin):
data = ...
Are we planning to use this multiple places? If not, why is it a mixin?