rosscdh / revision

video revision system
1 stars 0 forks source link

VideoCommentsMixin only used once #6

Open miped opened 10 years ago

miped commented 10 years ago

Are we planning to use this multiple places? If not, why is it a mixin?

rosscdh commented 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"

miped commented 10 years ago

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.

rosscdh commented 10 years ago

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 = ...