Jul 22, 2017 · 1 min read
Their gripe against composition is really a gripe against the composite pattern — the easiest way to accomplish composition in Java. In JS, you can do mixin composition, which does not require you to manually delegate to an internally held component. Instead, the mixin props become instance props, similar to multiple inheritance, but without diamond-problem ambiguity.
As I mentioned in the article, in Java, it’s much easier to justify chosing class inheritance. Any time you just want a slight differential, it makes sense in Java to use class, but since that’s even less work with mixins composition in JS, there’s no tradeoff that would justify the less-flexible class inheritance route in JS.
