Alternatives to MixinsSam Doiron
Mixin classes are divisive. The dangers of mixins are well documented, runaway coupling, unclear method origins, etc. However, they remain popular. I contend this is because mixins solve two common problems in an accessible way. These uses are
- A wrapper around an object that strictly adds new functionality.
- A set of methods that serve a specialized purpose.
By separating these use cases, we can better solve each problem, and avoid the dangers of mixins.