In the agnostic language, mixin simply adds functionality to the class and is more suitable for the convenience of programmers and avoids code duplication. An abstract (base) class forms an is-a relation and allows polymorphism. One of the reasons for abuse of inheritance is that it is an easy way to implement mixins without writing a template in languages ββthat do not actually support them. The problem is that you are claiming that polymorphism is a relationship as a side effect, which makes your API more confusing and possibly adds ambiguity. Therefore, newer languages, such as D and Ruby, support mixins as native functions, which makes it convenient to add a bunch of functionality to the class without declaring polymorphic relationships.
dsimcha Feb 26 '09 at 16:54 2009-02-26 16:54
source share