Safer JavaScript Object Composition With Traits and Traits.js

added by Jaime González
1/4/2016 1:37:38 PM

713 Views

Mixins while awesome have some limitations. In particular, conflicting mixin methods and properties are overwritten when using Object.assign. Moreover, you don’t get any warning when this happens. Updating a mixin with new functionality at some later point in time can inadvertently change the behavior of some of your objects. Traits offer a solution to this problem by providing a safer and more structured way to do object composition.


0 comments