

Knockout 3.1 ships - johnny_reilly
http://knockoutjs.com

======
shaunol
Knockout is so, so good.

I just wish it had proper API documentation. There are no real docs, only
examples/tutorials, this can be quite frustrating.

If you've never used data bindings in HTML/JS, you HAVE to give this a try.

If you're still using jQuery & other manual event handlers to change the state
of your UI, you GOTTA try it!

~~~
jf22
If you've never done a SPA before just skip knockout and head to angular or
ember.

Your app can out grow knockout and then your stuck rolling your own location
provider,dependency injection and more.

2-3 years ago knockout was a breath of fresh air but know its just old and
dated technology.

~~~
shiz
Can you elaborate on why knockout is old and dated? It's HTML and JS, just
like the others.

And compared to the bloat that is angular and especially ember, I find
knockout strikes with simplicity and 'keeping-it-simple'.

~~~
taude
It's not. And not everything should be architected as a SPA, but more likely
multiple page SPAs. Your users probably don't go to every module of a large
app with the same frequency...

------
siegecraft
Release notes:
[https://github.com/knockout/knockout/releases/tag/v3.1.0](https://github.com/knockout/knockout/releases/tag/v3.1.0)

------
noir_lord
I absolutely adore Knockout.js.

I'm building a large enterprise SaaS system single handedly and while I'm a
competent to good backend developer my front end skills are weak (mostly
ancient JS and then jQuery stuff up to writing jQuery plugins) and Knockout
has saved my bacon (when combined with Bootstrap 3).

It took me a weekend to get my head around the approach (and force feed some
JS knowledge I was weak on) into my head and then on the Monday I wrote my
first custom binding handler to allow me to do async file uploads (think Gmail
attachments) as easily as

    
    
        <input data-bind="ajaxfile: { property: 'photo', url: '/ajax/upload', maxsize: 8388608, image: true}" type="file">
    

The ability to use that to upload a file into the temporary store, return the
hash for the file which is then submitted when the form is saved makes for a
nicer UX (I hate those You clicked save not wait 5 minutes while we attach
these pdf style messages) and has saved me a huge amount of time trying to
shoehorn more complex jquery plugins that kinda-sorta do what I want if I
squint at them.

The actual architecture is multi-page with each page been bound to it's own
view model (as the vast majority of pages are either forms, editing forms or
showing tables) this has worked out really well so far (I also have a custom
binding to bind a knockout property directly to a jquery datatable 1.10
instance which has made life somewhat easier but it's hairy code (on the limit
of what I'm capable of with javascript)).

------
Romoku
Knockout is my go to library when I need data binding. It's lightweight and
doesn't interfere with your markup.

~~~
stoodder
This is my favorite 'feature' of knockout. It's as simple as knowing a single
attribute 'data-bind' or comment pattern '<!-- ko ... -->'. The only down side
that I've seen is not having an 'else' statement :/. That's just a by-product
of how knockout's bindings work though and hasn't stopped me once from keeping
it my preferred library.

------
leo_mck
It always baffle me how little people here talk about DurandalJS (that uses
knockout for its bindings). It is a nice alternative to angular... and it uses
knockout which is awesome. If you like knockout, you should really take a look
at it.

~~~
avenger123
Is it still worthwhile if you're not developing single page apps?

~~~
Romoku
You can add SPA functionality to any page on a website. There's nothing
preventing you from using your favorite SPA stack on specific pages.

~~~
taude
Exactly this. Most people's huge, monolithic apps should be partitioned out
into smaller, more modular apps. They're easier for multiple developers to
work on, they're easier to spec out, they can have their own
optimization/iteration cycle, etc.

An example, we have an app that so far consists of about 25 individual SPAs.
It was originally an SPA, but we ran into tons of problems with routing issues
that cropped up, and realization that when the user uses the apps, in any
given session they'd probably only use 20% of what it offers. Developers get
to work quickly on their modules, there's no up front initialization/download
of the entire apps. Some of the apps are more prototype quality to get the job
done, some have been refactored several times. But they all form a cohesive
experience. It's also nice when you're developing a group of functionality
that you don't have to start the app at the beginning.

Most users won't even know when their in a SPA vs Multi-page SPA.

------
basicallydan
I love knockout but I'm not sure whether to risk using it in mobile apps. Can
anybody report on performance in a mobile SPA with a few views?

~~~
taude
We're using it in a responsive website that renders on tablets...not quite
mobile, and not delivered via a packaged web-view app. It performs fine for
99% t of our use cases on more modern tablets. Most JavaScript apps suck on <
iPad 2 vintage tablets anyway. I wouldn't go rendering a 1000 templates
client-side with it. (We have one list that renders a complex template 100x)
and it takes about 3500 ms for the knockout rendering of it. This template has
maybe 20 conditionals in it or so.

~~~
basicallydan
That's good to hear. Thanks very much for your thoughts :)

------
diggan
Actual changelog for people interested:
[https://github.com/knockout/knockout/releases/tag/v3.1.0](https://github.com/knockout/knockout/releases/tag/v3.1.0)

TL;DR: "This release focuses mainly on performance and stability/compatibility
improvements, plus small enhancements to existing functionality (yes, we're
saving the big new features for v3.2). [...]"

------
Mizza
Any Django developers interested in Knockout may want to checkout my Django-
Knockout-Modeler project:

[https://github.com/Miserlou/django-knockout-
modeler](https://github.com/Miserlou/django-knockout-modeler)

------
bvanvugt
This is awesome, always happy to see continued work on Knockout.

We use it in our production single-page app at sendwithus, and while AngularJS
is tempting, Knockout is so lightweight and nimble that it lets us move really
quickly on front-end features.

------
benmorris
I'm a big fan of knockout. I find myself using it in a lot of places. The
declarative binding makes it so much easier to come back months or weeks after
writing code and clearly see what is going on. That is opposed to the old way
of using Jquery and a mess of glue code to tie models and elements together.
Knockout has also saved me a lot of time and reduced the amount of javascript
needed significantly.

------
mattchamb
knockout is such an awesome library. I have only used it for a few toy
projects, but I love how lightweight it feels; and how it doesnt feel like it
takes over all of your html.

I also love how the ko.observable doesnt feel as magical as the angular
binding. It makes me feel alot more in control

~~~
mattmanser
Yeah, instead it takes over your javascript turning properties into methods:

    
    
        var myViewModel = {
            personName: ko.observable('Bob'),
            personAge: ko.observable(123)
        };
    
        myViewModel.personName() //get
    
        myViewModel.personName('Mary') //set
    

Makes my eyes bleed.

~~~
gdrulia
Yeah, at least this way you have control over which properties are methods.

Also, if you really prefer angular.js style of tracking dependencies, this
plugin makes the trick [http://blog.stevensanderson.com/2013/05/20/knockout-
es5-a-pl...](http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-
to-simplify-your-syntax/)

~~~
mattmanser
Thanks, looks good.

I know it sounds pedantic but it's not 'prefer', it's that the properties as
methods is fundamentally changing the way the language works and is very
brittle.

~~~
klibertp
[http://en.wikipedia.org/wiki/Uniform_access_principle](http://en.wikipedia.org/wiki/Uniform_access_principle)

In short, it doesn't matter which it is - a method or an attribute - as long
as it's consistent.

What fundamental changes to the language you see when using methods instead of
plain attributes? Aside from the fact that setter and getter methods in JS are
bindable while attribute access is not.

~~~
mattmanser
You're kinda arguing against yourself as the code won't be consistent. You're
changing a _part_ of your code but not all of it and it just leads to brittle
code as you're never sure what you're working with, especially in a
dynamically typed language like javascript with terrible support for editor
behaviour sniffing.

Every time you have an object you have to remember whether it's a normal JS
object or a properties-as-methods object. Using knockout to handle your view
models doesn't magically change the rest of your code. All the other code you
write and libraries you use will be using properties the standard way.

Secondly, the uniform access principle (which you seem to misquoting? It's not
about consistent access by type, it's about all types having identical methods
of access).

It comes across as something an academic would propose because it's
intellectually enticing but practically detrimental.

Think of it like changing a, it, the, we, you, our, etc. all to be o. Yeah,
now you can change nouns freely, but the syntax is a signal and the difference
is _useful_.

A method is conceptually supposed to be different to a property and so it
should _look_ different.

Javascript's bad enough for readability with everything being a function.

Whether you agree with it or not, in the end it's simply not how javascript
works. Methods and properties are accessed differently.

------
NicoJuicy
Using knockout since shortly because it's more supported on .Net (it will ship
with Visual Studio).

And i have to say, i'm amazed by it.. It's pretty awesome to create my first
EditableHTML :)

------
jimaek
Added to CDN too
[http://www.jsdelivr.com/#!knockout](http://www.jsdelivr.com/#!knockout)

------
caseyf7
What about Ractivejs.org? It looks similar. Can anyone compare their
experience with the two?

