Mixins are a powerful concept for object-oriented class composition. re-mix provides mixins for C# and Visual Basic .NET.
Source Code: https://svn.re-motion.org/svn/Remotion/trunk
While C# and VB.NET are continuously improving, they still support only a single mechanism for class composition: single inheritance. Over the years, many other mechanisms have been tried, among them multiple inheritance, mixins and traits. These mechanisms allow for a more flexible composition of classes from various sources, therefore enabling new programming techniques that reduce code redundancy, increase the expressiveness of code and allow for a more direct mapping of mental models to code.
Some of the features of re-mix are:
- Create mixins that add interfaces with implementations and state to other classes
- Override class methods in mixins
- Implement abstract mixin methods in classes that use mixins
- Apply any number of mixins to any class
- Apply mixins statically via attributes, or dynamically via code
- Apply mixins on application startup without starting any tools, or at build-time as you prefer
- Add and remove attributes via mixins
- Mixins can derive from each other, and mixins can even be applied to mixins
What's the diffrence between mixins and extension methods?
Additional information about mixins and re-mix:
- Wikipedia article on mixins - Learn what Mixins are and why they are useful in OOP design
- Lang.NET Symposium - Get an overview on re-mix and learn how you can benefit by using them.
- Hands on Lab on when to use re-mix - Jump right into development with this hands on lab.
- Fabian's Mix on re-motion Mixins - Get deeper insights by reading the blog of the original developer of re-mix
- re-motion Team Blog on Mixins - Get deeper insights by reading the blog of the development team
If you have questions regarding re-mix, contact the development team via our Google Groups page. Please follow this project to stay informed about updates!