
Introducing Knockout, a UI library for JavaScript - gibsonf1
http://blog.stevensanderson.com/2010/07/05/introducing-knockout-a-ui-library-for-javascript/
======
gregwebs
home page: <http://knockoutjs.com/>

would be interesting to compare with backbone, which has facilities for
automatically updating views: <http://documentcloud.github.com/backbone/>

flapjax was one of the originals- porting functional reactive programming to
javascript, but has never caught on in a strong way. <http://www.flapjax-
lang.org/>

~~~
gibsonf1
Backbone looks amazing - plan to deploy with it soon. The idea of creating a
model with properties and bind events to that means that if a variable
changes, all elements referring to the model are updated automatically. And if
that isn't good enough, it supports persistence back to the server, making for
interesting possibilities both with having data on the client side, but also
supporting exact state reproduction when someone logs back in from an earlier
session. Intriguing.

~~~
gibsonf1
This is great, Backbone supports undo! You can simply use the
.previous(attributes) function :)

------
petervandijck
Looks pretty good. In short, (if I understand this well) it solves the problem
of updating a value in an ajax app and then having to update lots of separate
different parts on the screen in js, which can get messy. They seem to be
inspired by Silverlight's approach.

~~~
johns
The Silverlight perspective is probably right since Steve is a long-time .NET
developer who recently took a job at Microsoft.

~~~
Jach
They all just copied from the Flex framework anyway. (Seriously that's been so
far ahead of the JS libraries for a long time. I'm happy Knockout exists so I
can use it!)

~~~
wallflower
Do you mean mx:Binding? I dislike mx:Binding as it has been buggy for us
(property value updated but UI does not update). I've resorted to avoiding it
and using EventDispatcher to notify views to update themselves.

In general, I think it is way too difficult to fetch data async from a server
and update the Flex UI. LiveCycle Data Services is more about push than real-
life async use cases.

~~~
Jach
Yeah, there's a few gotchas to watch for with binding that depend on the
datatype. Flex 4 has only improved things, though it did take a bit to adjust.
I really like the {syntax} though, and apart from the binding issues with XML
I really like working with it in Flex but hate it in JS. Flex makes the XML
vs. JSON distinctions almost go away for me.

(tldr: yeah, async stuff in Flex can sometimes be really verbose.) I don't
find the async stuff too bad, though it all can horribly be abused. The
project I inherited used Cairngorm with SOAP services and had a separate
Event, Command, and Delegate class for every web service! Some generalizations
have made that into only one Command class per web service that's just
responsible for handling the specifics, though I also have a general Command
class that will offload the response to a callback function the requester can
provide. I always liked Ext's (er, Sencha's...) Ext.Ajax.request() and
jQuery's offering.

~~~
wallflower
Yes, our project was bootstrapped initially by a bunch of Cairngorm loving
consultants. I doubt we will move to Flex 4 as we have common company library
SWCs that would have to move to Flex 4.

------
wahnfrieden
Dojo Toolkit offers similar declarative data binding functionality, FWIW. You
can use most of Dojo (particularly the Dijit UI library) declaratively if you
want to.

------
eddiegroves
Steve spoke with Scott Hanselman recently on his podcast show about Knockout:
<http://www.hanselminutes.com/default.aspx?showID=262>

------
daralthus
OFF: Is there any language or framework that uses heavily this "observable
variables" paradigm, for example for data processing? (except s4.io)

------
drivebyacct2
I had to Google "Knockout JS" to find a link, then I found out the OP was
referencing the same thing. Seems cheap to call it just a UI library.

