On Wed, 21 Apr 2010, Greg Brown wrote:

[snippage]

One of the goals of MVC was to create an independent model which could be presented through multiple concurrent views...But, and this is a big *but*, what if elements and properties of the data model can be changed through one or more of the tables?
...
Eh. You see where I'm going. "Load-n-store" is going to fall apart here. Bi-directional event-driven binding between model and view (maybe through a controller or whatnot) will save the day.

That's where an MVC framework comes in.

I don't see how that helps. But if you think I'm suggesting some kind of MVC framework, then I can certainly understand why you think event-driven data binding is a big ugly mess. Because MVC frameworks produce apps that are big ugly messes.

Interestingly, I see you *are* using event-driven data binding for list-based mutations. But if you change a property of an element of a list, the list does not dispatch an event. The view remains ignorant.

This is also true of Flex, as I recall. You need to notify the list that the data has changed.

Not true--not if the changed property is bindable. A list automatically listens for change events from all of its members. If a bound property changes, the member will dispatch a change event, the list will catch it, wrap it as a kind of list change event, and dispatch it up the event chain. No assembly required. :)

Where I'm coming from (data binding in Flex), doing this stuff with custom event listeners/dispatchers is a real chore. Yeah, it can be done, but it's a *lot* of work writing all that boilerplate.


One of the features we added for Pivot 1.5 is a pub/sub event model that is meant to help facilitate application level messaging. You may find it useful.

Hmmmm... I will check it out.

I'd also recommend looking into some of the client-side MVC frameworks. I haven't done much work with them myself, but I suspect that they may provide some of what you are looking for. On the other hand, if you can't find something that fits the bill, why not create something yourself and submit it as a contribution to the platform? ;-)

I would happily submit a set of patches if I thought they had a good change of being accepted. Ha. Don't want to do all that work for nuthin'.

I will suggest a design for some new functionality to support my beloved event-driven data binding in a follow up message.

Cheers,

Michael

Reply via email to