MVC framework for Dart

192 views
Skip to first unread message

Renat Zubairov

unread,
Nov 18, 2011, 11:08:23 AM11/18/11
to General Dart Discussion
Hello all,

I was browsing though the source of the slider_sample and in the
view:observable I found a couple of interfaces and classes for
implementing an Observer pattern, which is fundamental for proper MVC
implementation.
Unfortunately I weren't able to find any samples of how that
observable library could be used, is there any? Tests would also be ok
to have a look at.

Generally speaking would it be possible to bind a DOM to Dart objects,
how complicated could it be to do so, any suggestions would also be
appreciated.

Renat

Bob Nystrom

unread,
Nov 18, 2011, 3:08:44 PM11/18/11
to Renat Zubairov, General Dart Discussion
On Fri, Nov 18, 2011 at 8:08 AM, Renat Zubairov <renat.z...@gmail.com> wrote:
Hello all,

I was browsing though the source of the slider_sample and in the
view:observable I found a couple of interfaces and classes for
implementing an Observer pattern, which is fundamental for proper MVC
implementation.

Right. We've put some work into an MVC framework, but we haven't had the time to explore it fully yet.
 
Unfortunately I weren't able to find any samples of how that
observable library could be used, is there any? Tests would also be ok
to have a look at.

observable has tests under client/tests/client/observable. The swarm sample app under client/samples/swarm uses it pretty heavily too.
 

Generally speaking would it be possible to bind a DOM to Dart objects,
how complicated could it be to do so, any suggestions would also be
appreciated.

We don't have direct data binding now. We just support event-based observation. You still have to update the DOM yourself in response to an observable's change.

- bob

Renat Zubairov

unread,
Nov 18, 2011, 3:28:50 PM11/18/11
to General Dart Discussion
Thnx for the quick answer.

I'm thinking about generic binding framework. I used to worked with
Eclipse EMF-based and Jface based binding frameworks and with
Sproutcore lately, however most of the cases there is a strong meta-
modelling and reflection model behind it.

How does it look for Dart now? Any news on reflection API?


On Nov 18, 9:08 pm, Bob Nystrom <rnyst...@google.com> wrote:

Bob Nystrom

unread,
Nov 18, 2011, 3:50:09 PM11/18/11
to Renat Zubairov, General Dart Discussion
On Fri, Nov 18, 2011 at 12:28 PM, Renat Zubairov <renat.z...@gmail.com> wrote:
Thnx for the quick answer.

I'm thinking about generic binding framework. I used to worked with
Eclipse EMF-based and Jface based binding frameworks and with
Sproutcore lately, however most of the cases there is a strong meta-
modelling and reflection model behind it.

Yeah, sproutcore was one of the frameworks we looked at when we started tinkering with this.
 

How does it look for Dart now? Any news on reflection API?

Gilad is working feverishly on it right this minute. As far as I know, reflection is the next big thing that will land in the language.

- bob

Justin Fagnani

unread,
Nov 18, 2011, 4:20:46 PM11/18/11
to Renat Zubairov, General Dart Discussion
Hi Renat,

I started porting a very sproutcore / Cocoa-bindings like library to Dart last week as part of my Dart experiments. This is something that I'm sure we agree will make building apps a lot easier. If I can move it to a public location I will definitely let you know.

Cheers,
  Justin


On Fri, Nov 18, 2011 at 12:28 PM, Renat Zubairov <renat.z...@gmail.com> wrote:

Renat Zubairov

unread,
Nov 19, 2011, 7:32:56 AM11/19/11
to Justin Fagnani, General Dart Discussion
That would be great to have something like this for Dart. I was also
wondering, when you would create an MVC framework for Web browsers,
would you consider using a run loop to defer DOM manipulation like
Sproutcore does?
Another good topic is how to implement observer pattern best on the
Dart object model.

Renat

--
Best regards,
Renat Zubairov

Nikos

unread,
Nov 21, 2011, 7:21:34 AM11/21/11
to General Dart Discussion
how complex is reflection to implement? AFAIK its a recursive
algorithm looking for ids or class types.

On Nov 19, 12:32 pm, Renat Zubairov <renat.zubai...@gmail.com> wrote:
> That would be great to have something like this for Dart. I was also
> wondering, when you would create an MVC framework for Web browsers,
> would you consider using a run loop to defer DOM manipulation like
> Sproutcore does?
> Another good topic is how to implement observer pattern best on the
> Dart object model.
>
> Renat
>

> On 18 November 2011 22:20, Justin Fagnani <justinfagn...@google.com> wrote:
>
>
>
>
>
>
>
>
>
> > Hi Renat,
> > I started porting a very sproutcore / Cocoa-bindings like library to Dart
> > last week as part of my Dart experiments. This is something that I'm sure we
> > agree will make building apps a lot easier. If I can move it to a public
> > location I will definitely let you know.
> > Cheers,
> >   Justin
>

> > On Fri, Nov 18, 2011 at 12:28 PM, Renat Zubairov <renat.zubai...@gmail.com>

Bob Nystrom

unread,
Nov 21, 2011, 12:48:06 PM11/21/11
to Renat Zubairov, Justin Fagnani, General Dart Discussion
On Sat, Nov 19, 2011 at 4:32 AM, Renat Zubairov <renat.z...@gmail.com> wrote:
That would be great to have something like this for Dart. I was also
wondering, when you would create an MVC framework for Web browsers,
would you consider using a run loop to defer DOM manipulation like
Sproutcore does?

Yup, that was one of the things we kept in mind while we were working on this stuff. If you look in client/observable, you'll see an EventBatch. It exists to handle batched deferred updates like that.
 
Another good topic is how to implement observer pattern best on the
Dart object model.

I don't know if there is a "best" way to implement it. It depends on what your specific requirements. I find Dart is in general a nice language for it since it has closures and nice syntax for them. If references to methods become canonicalized, that will make it a little handier. User-defined callable objects (like C++ functors) have been discussed before, and those would help too.

- bob

Sean Eagan

unread,
Nov 22, 2011, 12:31:46 PM11/22/11
to Bob Nystrom, Renat Zubairov, Justin Fagnani, General Dart Discussion
On Mon, Nov 21, 2011 at 11:48 AM, Bob Nystrom <rnys...@google.com> wrote:
User-defined callable objects (like C++ functors) have been discussed before, and those would help too.

Not sure what the discussion around callable objects has been, but it seems like an operator would work nicely...

class Foo {
  //...
  Bar operator () (List positional, Map<String, Dynamic> named) {
    //...
  }
}

Function of course would implement this operator, and types could extend / implement Function to indicate that they are callable.

Thanks, 
Sean Eagan

Bob Nystrom

unread,
Nov 22, 2011, 1:44:10 PM11/22/11
to Sean Eagan, Renat Zubairov, Justin Fagnani, General Dart Discussion
I'm not sure what the proposed syntax is, but that's pretty much the idea as far as I know.

- bob

Reply all
Reply to author
Forward
0 new messages