kriszyp/compose — pull request #12 by iaincarsberg (2012-01-15 00:09:48+00:00)
Title: Compose.expand

Hello Kriszyp,

I've been working with compose for a while now, and utterly loving my experience with it. I've recently had an idea on how to expand its functionality.

Its worth nothing that the code I've sent a pull request for likely needs more work doing to it, so see this as more of a work in progress, I'm aware there maybe security implications in regards to my changing the 'constructorsLength' variable, so this maybe a pointless submission.

Firstly I think I need to exemplify its usage, to help it make sense, basically I use compose with RequireJS, so my project organisation consists of lots of small compose files, that are used in a moduler fashion. To make unit testing highly complex objects easier, I've found that breaking functionality down into smaller and smaller blocks helps improve the quality of my code, and as such the ability to expand composed objects is very appealing to me.

To demo this I've prepared the following gist https://gist.github.com/1613428

The general idea is that each area of functionality relating to a specific object can be broken down and tested in separation, then using RequireJS all of the sub modules can be composed into one module, and used as normal.

Feel free to be as critical as you feel the need, as I understand this implementation likely has some flaws.

Thanks
Iain