First off, let me say that I feel we're going in the right direction with the MVC component approach, and though we haven't solidified the details yet, the rest of the features should be decoupled enough that it doesn't matter the implementation. I just had this thought this morning and so wanted to get it out there first. Hope you don't mind. I'll get back to the mvc discussion next email. ;)
Problem
Flex has tried to build in all the common features they thought everyone would want to use. We know they've missed some: the ones we need for project X. We also know they've added to many: the ones we don't need for project X. If you want to add a new feature to all components in Flex you have to monkey patch it.
We need a plugin architecture. Something very simple and small that can listen to the component events and can also add API to the component.
Possible Solution
We could add features at runtime that initialized when set on the component and added API through a lookup. The implementation could be a small proxy object (hash map/associative array) called features. When you assign an "IFeature" to it, it will set the target of the IFeature to be the component. An example of how it would work is this:
list1.features.drag = new DragFeature();
list1.features.drag.enabled = true;
list1.features.drag.moveEnabled = true;
list2.features.drop = new DropFeature();
list2.features.drop.enabled = true;
and
mybutton.features.cursor.current = "busy";
The reason we would make the features object a proxy that sets the target rather than passing the target into the constructor would be so features could be added via styling, and/or so we could have a features factory that allowed setting up all the features for your system you want to be able to use.
Then you have pay-as-you-go, and you still have the ability to add new functionality to the entire component set. No more monkey patching. No more bloat for unused features. And the features object with a factory could probably be 1/2k or less I would bet. One small proxy class.
What do you think?
Jacob
Side note for Ben:
Tyler and I have talked about behaviors at times as add-on features. That's why we originally wanted an array of behaviors. But really, there is usually just one controller (behavior) per component that hooks up to the skin and handles user interaction. The add-on functionality is covered in this "features" concept or whatever other plugin architecture we end up going with.