3 ms·
Mixins can be modeled as inheritance or as composition.
by pitaj 8y ago
Mixins can be modeled as inheritance or as composition.
- seanmcdirmid 8y agoBoth Flavor-style mixins and Bracha style mixins utilize inheritance. All mixin definitions should fan out from that early work.
- dvlsg 8y agoI think composition and mixins should be kept separate. In my mind (and maybe I have an incorrect view of it), mixins throw a bunch of new properties on the base object, whereas composition keeps the original object encapsulated in a single property. Would you consider the second type to be a mixin? I've never heard it described that way.
- dragonwriter 8y agoThey can be modeled as inheritance or as composition plus delegation, but that's not saying much since inheritance itself can be modelled as composition plus delegation.