Classical inheritance is obsolete
axel at rauschma.de
Sun Jun 30 16:42:43 PDT 2013
To me, single inheritance has always been the skeleton on which I hang multiply inherited pieces. That skeleton doesn’t even have to be a hierarchy, it could be a set of classes.
Maybe you simply need to write a mixin or trait library that works well with ES6 classes?
On Jul 1, 2013, at 0:22 , Eric Elliott <eric at ericleads.com> wrote:
> "Honest question: how can this problem not be solved via ES6 classes plus mixins? The original hierarchy already feels wrong. Why not create a super-class Animal, with sub-classes Human, Ape, Bird, Bee, Fish, Whale plus the mixins Walking, Flying, Swimming?"
> I completely agree with you, but in the real world we don't always have the benefit of knowing future requirements enough to create the correct design from the outset. Maybe the design was correct in the beginning (immagine a classification of species, instead of a classification of species capabilities)... and that's the problem with class - "so you go to re-implement them as mixins, but now you have to refactor all the animals that already rely on those features"
> "I also don’t see why refactoring is such a bad thing: as your knowledge of the problem domain increases, the structure of your program evolves."
> Small refactors are not a bad thing, but class hierarchies create tight coupling between child and parent classes (yes, even ES6 class, especially with super). In these situations, the dependencies are not always obvious, or direct, and they tend to ripple out far and wide, and are not easily aided by technology -- it's not a matter of replacing some variable names across your project -- it's a matter of reengineering these to deal with systemic changes in behavior.
> Mixins and other compositional reuse patterns don't create any tight coupling between child and parents, and much more easily provide for selective inheritance (I only want the banana, not the gorilla, banana, and entire jungle).
> - Eric
Dr. Axel Rauschmayer
axel at rauschma.de
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss