View Full Version : difference between mixins and plugins and why should you care
6 Aug 2012, 3:36 PM
What is the difference between mixins and plugins and when should you use them? I've seen a few posts online but I want to hear your opinions on it.
A mixin adds extra functionality to the class directly. So, for example, when the Observable mixin is used, it adds on/un/etc to the class so you can call them directly.
A plugin is more of a "call out" functionality, the component asks the plugins to initialize and then the plugins (usually) listen to events on that component and reacting., instead of directly adding any functionality.
7 Aug 2012, 11:31 AM
If mixins add extra functionality to the class directly, wouldn't it be better to use mixins instead of plugins? I'm sure due to the nature of plugins being some kind of external entity you would run into issues because of that.
A mixin augments a class while a plugin augments an instance of a class.
Much better way of putting it.
Powered by vBulletin® Version 4.1.5 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.