tag:blogger.com,1999:blog-9210025386133363283.post8787888837568311189..comments2023-12-18T02:17:56.198-08:00Comments on Modern JavaScript: Compose, don't inherit (not a lot anyway).rhysbrettbowenhttp://www.blogger.com/profile/05642824819846878549noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-9210025386133363283.post-57629763460155238802013-10-29T19:12:43.473-07:002013-10-29T19:12:43.473-07:00If you find yourself wanting to go back to remove ...If you find yourself wanting to go back to remove items from the chain then you're probably applying things too early in the chain. Keeping the chain as shallow as possible will help and only applying things when you need them.<br /><br />As for duplication of functions, you could declare a function outside your mixin and use a reference so it points to a single function, but in the complex applications I have used this with I haven't seen any performance issues (I have had some objects with over 20 mixins on and that would have a function decorated with more than 6 levels or arounds that would be used over 100 times on the page with other things - approx. numbers off the top of my head).rhysbrettbowenhttps://www.blogger.com/profile/05642824819846878549noreply@blogger.comtag:blogger.com,1999:blog-9210025386133363283.post-38806002295803388752013-10-25T14:30:18.223-07:002013-10-25T14:30:18.223-07:00With composition you don't keep a single sourc...With composition you don't keep a single source, you create duplicates as you need. Is this raising any concerns: each duplicate runs its show, and how do you go back the composition chain, if needed?Anonymoushttps://www.blogger.com/profile/04367504761552812231noreply@blogger.comtag:blogger.com,1999:blog-9210025386133363283.post-87500406784946550982013-09-27T16:51:56.676-07:002013-09-27T16:51:56.676-07:00There are lots of great reasons to use composition...There are lots of great reasons to use composition instead of classical inheritance. For more details, check out my talk, "Classical Inheritance is Obsolete: How to Think in Prototypal OO"<br /><br />http://ericleads.com/2013/02/fluent-javascript-three-different-kinds-of-prototypal-oo/Erichttps://www.blogger.com/profile/16599386844775109135noreply@blogger.com