The tag has no usage guidance.

learn more… | top users | synonyms

8
votes
4answers
359 views

Parallel hierarchies - partly same, partly different

There are quite a few similar questions out there 1, 2, 3, 4, but non seems exactly the case in this question, nor do the solutions seem optimal. This is a general OOP question, assuming ...
3
votes
0answers
46 views

Relationship between a mixin and its master invokation

I haven't studied Smalltalk or Strongtalk and am just trying to get an overview of the semantics of interfaces and polymorphism in O/O languages, particularly Dart. In the 2002 paper titled Mixins in ...
17
votes
1answer
2k views

Why not make a language with mixin-only inheritance? [duplicate]

It seems that in all class-based or prototypal OOP languages, mixins are either an afterthought or a secondary feature. However, to me it looks like traditional inheritance is just a specific case of ...
5
votes
1answer
663 views

JavaScript extend vs mixin

After having read Eric Elliott's Fluent JavaScript article, I was and still am toughtful about the way to play with instance prototypes. On one side, you have the extending inheritance... var B = ...
36
votes
1answer
3k views

How are mixins or traits better than plain multiple inheritance?

C++ has plain multiple inheritance, many language designs forbid it as dangerous. But some languages like Ruby and PHP use strange syntax to do the same thing and call it mixins or traits. I heard ...
2
votes
1answer
142 views

Does a Mixin By Definition Allow Storing Data in Mixin-Level Instance Variables?

Several implementations of mixins (e.g. Ruby mixin, Scala trait) include support for storing data (e.g. variables, properties) between method calls in instance variables. There was a bit of debate in ...
6
votes
2answers
3k views

Are Interfaces with Java 8 Virtual Extension Methods the Same Thing as Mixins?

This post describes a new feature in Java 8 called virtual extension methods (formerly called default methods, or defender methods). In the example provided, an interface has one method, which is ...
4
votes
2answers
2k views

Python multiple inheritance or decorators for composable behaviours

I recently discovered (or rather realised how to use) Python's multiple inheritance, and am afraid I'm now using it in cases where it's not a good fit. I want to have some starting data source ...
1
vote
1answer
837 views

When to use mixins in Ruby

I am wondering when to use mixins? I have read about them. Many authors compare them to interfaces, abstract classes, etc. Mixins are modules that are mixed-in and modules are a way to group similar ...
17
votes
4answers
4k views

Inheritance vs mixins in dynamic languages?

When should you prefer inheritance patterns over mixins in dynamic languages? By mixins, I mean actual proper mixing in, as in inserting functions and data members into an object in runtime. When ...