PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: pwhitfie on September 20, 2007, 09:27:33



Title: data binding
Post by: pwhitfie on September 20, 2007, 09:27:33
Hi,

I'm wondering where (if?) flex data binding fits into the pureMVC model.

It seems to me that the intention is for Mediators/Proxies to handle the updating if models and view components when something changes or am I missing something?

Cheers,

Peter


Title: Re: data binding
Post by: puremvc on September 21, 2007, 07:46:22
PureMVC was written to be a pure ActionScript implementation. MXML data binding is Flex-centric and therefore was considered verboten for framework functionality. When PureMVC is ported to Tamarin (or even to non-Actionscript OOP platforms like J2ME), if MXML data binding were core to the PureMVC implementation, we'd have to rethink the thing entirely.

But obviously, use of PureMVC should not keep you from using all that wonderful data-binding goodness that Flex gives us! Frameworks should play well together, thats the way synergy happens.

Although internally, a PureMVC application 'wires' itself up by way of communications between Commands, Mediators and Proxies, the View Components themselves frequently make heavy use of data-binding. For a good example, simply pop over to the Architecture 101 Demo here on the PureMVC.org site, click View the Source, and in the view.components folder, have a look at the UserForm.mxml class. Lots of data-binding going on there.

Data-binding is a wonderful tool for doing the 'internal wiring' of View Components. It really helps us to achieve a nice 'black-box' encapsulation of our implementation. Rather than having a Mediator set data down into the actual controls of a View Component, we have the component expose a property, which we then bind our controls to. So when the Mediator sets the property, the controls are updated automagically, and the Mediator didn't need to know very much at all about how the component was implemented.

-=Cliff>