Re: Model-driven Views

Thank, Nathan.

I hadn't known of Knockout, but it looks pretty great. Conceptually,
its design is very similar to MDV. Notably, the two big items:

-Observable JS object properties and Arrays.
-DOM-based template production (although they work with JQuery
templates which are string-based).

The automatic dependency tracking is interesting. We looked at some
work published by Adobe/Texas A&M on declarative property models
(http://parasol.cs.tamu.edu/~jarvi/papers/gpce08.pdf,  a very
unsophisticated example in our use_cases
http://mdv.googlecode.com/svn/trunk/use_cases/property_model.html).

Knockout re-affirms for me that:

-Dynamic web apps increasingly load one or more views as HTML but talk
to their servers via a data API. Having to write lots of imperative
code which shuttles data into & out-of the DOM is a bummer. It's not
especially interesting code and it tends to be error prone. A
declarative approach can do much better.

-There are basically only two approaches to templating: DOM-based
(MDV, Knockout, Angular, JSTemplate) & String-based (JQuery, and a ton
of others). In the video, Steve explains (at about 12:40), indirectly,
that DOM-based is required if you are going to dynamically update your
view: performance. The other reason is DOM-stability.

-In order to get this kind of approach to work, you need some way of
observing when data has changed. There are four options for this that
I know of:

1) Run-time support for direct observation (e.g. Adobe Flex, WPF)
2) Value-holder pattern (e.g. Knockout, Sproutcore)
3) Proxy pattern (e.g. MDV)
4) Dirty checking (e.g. Angular)

The only two options available to webdevs are 2 & 4, and both
currently require some fairly unnatural contortions.


On Mon, Apr 25, 2011 at 12:26 PM, Nathan Kitchen <w3c@nathankitchen.com> wrote:
> Have you heard of knockout.js? It's an MVVM pattern based on JQuery, if
> you're not aware of it you may be interested to see their approach.
> Official site:
> http://knockoutjs.com/
> Recent MIX event:
> http://channel9.msdn.com/Events/MIX/MIX11/FRM08
> Just FYI as it was related...
>
> On 23 April 2011 01:35, Rafael Weinstein <rafaelw@google.com> wrote:
>>
>> Myself and a few other chromium folks have been working on a design
>> for a formalized separation between View and Model in the browser,
>> with needs of web applications being the primary motivator.
>>
>> Our ideas are implemented as an experimental Javascript library:
>> https://code.google.com/p/mdv/ and the basic design is described here:
>> http://mdv.googlecode.com/svn/trunk/docs/design_intro.html. It's not
>> complete and there are things we're not happy with, but it's
>> self-consistent enough that you can start to imagine what a full
>> design might look like.
>>
>> We hope to get others interested in collecting requirements/use cases
>> and fleshing out a good solution.
>>
>> We're starting the discussion here because a few people in this group
>> from whom we got early feedback felt that it would be most appropriate
>> place and, further, that this work bears some relation to XBL.
>>
>> What do you think?
>>
>>
>
>

Received on Wednesday, 27 April 2011 00:04:48 UTC