JavaScript Mixin Remix

JavaScript is an amalgam of function and state. State is generally specific to instances, while functions will almost certainly be shared across instances. Maybe it’s in our interest to separate these two most basic concerns and maybe mixins can help us do this.

In particular the functional mixin pattern offers a clear delineation. Objects are state while functions are organized in bunches like fruit on a tree, ripe for picking. In fact the strategy can be extended beyond pure mixins – functional sets can act as repositories for any object…

Angus Croll has a nice fresh look at JavaScript mixins. He walks through a variety of stages and techniques surrounding mixins vs. classical inheritance.

He walks through various techniques and also profiles them to show the trade offs between some of the options, and how to optimize some of the techniques with caching and currying.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.