Mixins Class parametrized by a superclass A mixin applied to a class return a class with mixed-in behavior Reuse functionality orthogonal to inheritance Implementation: based on single inheritance linearisation Mixin inheritance Mixin inheritance is an approach that avoids many of these multiple inheritance problems Mixins are combined by using the regular single inheritance operation Mixins are always applied one after the other Implications Super is late bound! This is only at composition time that super will identify the right class. A mixin can be mixed in several classes Super refers to different classes! Similar to call-next-method (CLOS, Dylan) Mixin Inheritance Limits Implicit conflict resolution Surprising behavior Composite entity is not in full control Dispersal of glue code Fragile hierarchies Traits Groups of methods Within single inheritance Supporting construction of class based on building bricks How are Traits Used? Traits are the behavioral building blocks of classes Class = Superclass + State + Traits + Glue methods
December 31, 2004
Mixin Inheritance PDF
No Comments
No comments yet.
RSS feed for comments on this post. TrackBack URL
Sorry, the comment form is closed at this time.