This. Knockout's tutorials made me far more seriously look at it than Ember for a side project I was playing around with recently, coming from the position of not knowing either of them.
We didn't actually find the documentation and examples that bad. I had a team of heavy front-end (html/css/Jquery) developers get up to speed in knockout fairly easily. It would have been a nightmare explaining to them how to make Angular directives and some of the more complex services stuff.
BTW, I think Knockout is just prescriptive enough to get a pretty tight maintainable codebase, but without causing another layer of wrapping/complexity when you want to use existing JQuery components.
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...
cant be worse than AngularJS doc... The doc doesnt make sense at all, the framework itself is not that complicated to use,but come on, the documentation is a shame,the new doc is even worse, less code exemples than before, nothing makes sense when reading it. Half the api is not explained. Instead of going with a simple rst / readthedoc format, they made (generated) something bloated and useless. I'm a huge Angular fan,but come on,it's not a little open source project,Google has the money to hire 1 person that can write docs...
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
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)).
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.
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.
I'd like to invite you to take a look at a library that I've been working on over the past few years called Falcon (http://stoodder.github.io/falconjs/). Falcon is an MVC structure around Knockout that is useful for small-large scale single page applications. I'll be releasing v0.10.0 which includes support for Knockout 3.1 and some other large changes within the next week or so. Always looking for feedback especially from those who've used similar libraries (Durandal). Regardless, I really dig Knockout, glad to see the continued work on it :)
If you're not developing SPA apps you'll likely just need data binding (knockout) only. I've had many situations where I don't need the routing and other functions of a SPA framework like Durandal. However, Durandal is pretty modular so you can tap into whatever part you need since it uses require.js.
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.
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.
Knockout is pretty focused on what it is for (data binding). In my experience it works well for mobile apps as well. If you want full blown SPA with knockout check out Durandal. I'm also using it with success on mobile.
It is all in how you set up your bindings. If you have everything 'visible' to the user at once you're going to get some slow performance.
I have a simple state observable and then I wrap my 'views' in a if: state() == 'x' knockout comment. This moves the entire view out of memory until the state changes.
In addition I have a fixture loader that loads the view files in as they are needed. This speed things up nicely as my base html file is much smaller.
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). [...]"
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.
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.
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
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.
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.
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.
I hated that at first, but it's really hardly a problem when it comes to actual development. And it's pretty nice for optimization to be able to mix/control what properties on a model actually need the notification changes, as opposed to other frameworks that just assume everything notifies. (Especially useful when you start dealing with object graphs with 100s of properties).
Angular was supposed to fix this, but when I got down to brass tax I had a hell of a time remembering if I was in or out of context and then having to cast my self back into context.
At least with knockout you know you are always out of context and have to use the getters/setters.
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!