views:

500

answers:

3

Are mixins considered a design pattern? Structural?

+2  A: 

Yes, it is in Ruby.

Design Patterns in Ruby

alex
+2  A: 

Yes, it is in D.

"A design pattern is a general reusable solution to a commonly occurring problem in software design" -- Wikipedia

D is compiled to machine code and with the use of mixins you can use it to make templates even more useful than they are in something like C++.

http://www.digitalmars.com/d/1.0/template-mixin.html

Tim Matthews
+1  A: 

They're a language feature. A "pattern" is different from a feature, in that it resolves a set of forces that may influence a situation in contradictory ways. Features, by their presence or absence, tend to create the forces that patterns resolve. Many design patterns (Double Dispatch is a good example) came about to work around language limitations (in this case method dispatching on a single argument).

Morendil
Not in .NET. It's more like a pattern.
4thSpace
If you know the answer, why are you asking the question ? ;)
Morendil
keyword is "like". That sounds unsure to me.
4thSpace
OK, I guess that answers the above. What will you do different based on whether it's considered a pattern or something else ?
Morendil
Looks like we're back to subjectivity so lets leave it where it is. To answer your question - nothing. Would you say mixins are similar to the visitor pattern? And in .NET through extensions - decorators?
4thSpace