The Composer class system is the base building block of all the objects Composer
provides (Model, Controller, etc). It is designed to be a standalone component
that doesn’t necessarily need to be part of Composer.
This is the main export of the class system:
NOTE: Composer.Class(...) and Composer.Class.extend(...) are the same.
Classes can be extended two ways. The vanilla, simple way is MyClass.extend.
Another way, which is used internally in Composer, is very similar to the above
extension method. It allows a class to additively extend certain static
properties of the parent class. This sounds a bit esoteric, so let’s dive in:
A class contructor is specified by its initialize function:
The class system allows calling parent methods using this.parent():
The class system supports mixins. When using these, it will merge in objects
from the mixins and the object being created. This can be useful for extending
the functionality of classes without using inheritance structures.
Mixins are defined as a special key in the class, _mixins, which is a function
that returns an array of mixin objects: