Re: Model-driven Views

On Sat, 23 Apr 2011 02:35:53 +0200, 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.

It looks an *awful* lot like the templating part of Web forms. If you get  
a copy of Opera 9.5 (we removed the code when it became clear that nobody  
else would implement in the last 3 years), you can see that in action with  
the attached code:

<div class="entry">
  <div id="repeatformcontainer">
   <div id="tem1" repeat="template" repeat-min="2" repeat-max="5">
    <input type="text" name="product.[tem1]" value="one thing">
    <button type=remove>Remove</button>
    <button type=move-up>Move Up</button>
    <button type=move-down>Move Down</button><br />
   </div>
   <p><button type=add template=tem1>Add</button>
  </div>
</div>

That in turn was a pretty straight rip-off from Xforms which allows the  
same thing with a little more power, and is even closer to what it seems  
you're looking to do.

> We hope to get others interested in collecting requirements/use cases
> and fleshing out a good solution.

I used it to create simple tools that created templates, and tools that  
used templates for collecting information. My first use case was a  
multilingual international court case (i.e. something that really mattered  
and not just a test), and the ability to easily generate custom systems  
was fantastic.

I greatly appreciated the ability to have models without needing to use  
script - as Steven Pemberton says of Xforms, this makes development much  
faster by reducing complexity in the code, and my experience conincides  
with that perfectly. While I could readily use scripting to develop the  
same systems I would expect the work to take longer and be substantially  
more complex to maintain and debug.

FWIW as far as you do make something script-based, I agree with the  
sentiment expressed that it should work well with existing libraries,  
helping them to reduce the towe-of-babel problem by converging rather than  
increasing it by adding yet another set of libraries to the mixture.

> 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

It probably makes sense to ask the Forms group as well, given that it  
doesn't require much squinting to get to the perspective where you're  
pretty much reinventing a wheel they've already got two of.

> and, further, that this work bears some relation to XBL.

As well, at least conceptually.

cheers

Chaals

-- 
Charles McCathieNevile  Opera Software, Standards Group
     je parle français -- hablo español -- jeg lærer norsk
http://my.opera.com/chaals       Try Opera: http://www.opera.com

Received on Sunday, 1 May 2011 20:30:00 UTC