Tuesday, May 29, 2012

Mixin vs. Inheritance

Abstract classes have been criticized not being examples of specialization -- allegedly the purpose of OO inheritance -- but rather of extension.

Well, to redeem the value of the abstract class, we simply call it a "mixin" and all is good and valid.


Mixins are synonymous with abstract base classes. Inheriting from a mixin is not a form of specialization but is rather a means of collecting functionality. A class or object may "inherit" most or all of its functionality from one or more mixins, therefore mixins can be thought of as a mechanism of multiple inheritance.
 http://en.wikipedia.org/wiki/Mixin

No comments:

Post a Comment