Hey there, I'm a little confused about this article. Are Mixins a real thing? Are they an idea you're presenting? Are they something upcoming in the JS spec?
A mixin is a class containing methods that can be used by other classes without a need to inherit from it. In other words, a mixin provides methods that implement a certain behavior, but we do not use it alone, we use it to add the behavior to other classes. It just shows that class based inheritance is not as flexible prototypal inheritance.
Great question and thanks for reading. Mixins are definitely real. There are times when you’d want to inherit from multiple classes or objects.
That being said there is no official way of implementing Mixins with JS. The lack of true inheritance or composition does lead to myriad of implementation techniques.
Would you ever need it? Maybe not.
Adding object oriented principles to JavaScript might not be fruitful in my opinion but I do bring them up for awareness.
http://perpetual.education is a design/programming school. We like to be part of the discussion over here at Dev.to / We have time-slots for free conversations for career advice IRL : )
Hey there, I'm a little confused about this article. Are Mixins a real thing? Are they an idea you're presenting? Are they something upcoming in the JS spec?
A mixin is a class containing methods that can be used by other classes without a need to inherit from it. In other words, a mixin provides methods that implement a certain behavior, but we do not use it alone, we use it to add the behavior to other classes. It just shows that class based inheritance is not as flexible prototypal inheritance.
Hey Jared,
Great question and thanks for reading. Mixins are definitely real. There are times when you’d want to inherit from multiple classes or objects.
That being said there is no official way of implementing Mixins with JS. The lack of true inheritance or composition does lead to myriad of implementation techniques.
Would you ever need it? Maybe not.
Adding object oriented principles to JavaScript might not be fruitful in my opinion but I do bring them up for awareness.
What do you think about 'stamp' ? medium.com/javascript-scene/introd...
Thanks a ton! As much time as I spend with JavaScript, I am surprised I had not heard of this. That means I have no opinion on it.. yet.
This gives me something new to learn over the next week or two. I appreciate that you brought it up.