🌺 The Very Same

Alternatives to Mixins

Sam 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

Decorators
A wrapper around an object that strictly adds new functionality.
Toolkits
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.

Decorators

Hi there