Mixins, Subclass Factories, and Method Advice in JavaScript
This is probably a somewhat fringe sentiment, but reading this reminds me very much of <a href="http:&#x2F;&#x2F;codeofrob.com&#x2F;entries&#x2F;you-have-ruined-javascript.html" rel="nofollow">http:&#x2F;&#x2F;codeofrob.com&#x2F;entries&#x2F;you-have-ruined-javascript.html</a> (I was making very similar comments while reading this)<p>I&#x27;ll readily admit I&#x27;m biased against OOP; I much prefer functional approaches. When I write Javascript, it tends to be pretty functional, with minimal OOP conventions.<p>But that said...all the problems this addresses are self-inflicted problems. The very start of the article even says as much, &quot;Mixins solve a very common problem in class-centric OOP&quot; - that is, &quot;these problems are only problems because you want to write Javascript in class-centric OOP&quot;, something it wasn&#x27;t really designed for (and the constant attempts have led to Ecmascript 7 and the &#x27;class&#x27; keyword, which I find myself shaking my head at; again, see prior link, at trying to make Javascript feel &#x27;enterprisey&#x27;).<p>Find another way to go about it maybe? The subclassFactory example he gives...if I saw that in a code base I&#x27;d want to punch someone. Because without the writeup he gives, I&#x27;d be staring at it, and the functions it calls, for a good 20 minutes before figuring out what it&#x27;s doing. And all it&#x27;s doing is trying to shoehorn a specific paradigm into a language not written for it. I mean, you can do it, sure, but -why-? I don&#x27;t really like Javascript but at least I feel pretty productive in it; why would I make it harder on myself, and everyone who reads my code after me, by trying to make it something it isn&#x27;t?