http://returnbooleantrue.blogspot.com/2012/12/architecting-k...
I personally don't like backbone that much. I don't know why so many people love the damn thing. It is hard to understand and not even that great.
http://returnbooleantrue.blogspot.com/2012/12/architecting-k...
I personally don't like backbone that much. I don't know why so many people love the damn thing. It is hard to understand and not even that great.
Also, in my tests for an app(PhoneGap) I did recently, it seems much faster than angular(rendering seems to take half the time)
Extensibility & hooks: Extending built in behavior in Knockout was much easier than in Angular. Without getting into too much detail, one of the things I tried to do was create a list of items on the page with a simple animation for item removal. In Knockout, it was trivial. In angular it would have required a copy-pasta style rewrite of the repeat directive.
Some weird missing features: Angular has no conditional add/remove element directive (that I could find). This just seems like a weird oversight. There's a show/hide element directive, but trying to substitute that for add/remove will break CSS first/last/nth child selectors.
Angular has a lot of potential, but it felt to me like it needs a few more iterations before I'd want to try to build a rich UI on top of it.
Angular does have a conditional add/remove element. You can use ng-switch for that. If you are using CSS selectors in an angular app I sense a smell. Something is not right.
You're right - you could use ng-switch for add/remove. It's a bit awkward though. I'm curious as to why you'd consider "CSS selectors" a smell in an angular app. I'm assuming you mean some subset of CSS selectors (possibly just the first/last/nth-child selectors I mentioned?), as without selectors you can't really have CSS.
Can you elaborate a bit? Thanks!
Angular is great but the problem is you really need to use client side templating for it to be useful. It also has the same syntax as django's template language by default. All this is workable but Angular is great for projects that you are starting. Knockout is better to integrate with existing projects.
Angular is exceptionally flexible and one of the first tools for building client-side JS that really impressed me. That said it is fairly complex (and not that well documented) when compared to Backbone, so I can understand why not everyone would be impressed. Cavet emptor. As an alternative Knockout is pretty simple, it's just not my thing.
Backbone is a neat tool and what it provides most people is a somewhat predefined structure to work in. Coloring between the lines is really useful. However (as the parent said) it really does very little other than that in the end really. There is almost nothing that Backbone does that a sensible use of jQuery binding and data attributes can't do as well or better. It's just that most people will find it easier to learn Backbone, which is great don't get me wrong, but don't be surprised to find people (like myself) who have moved on.
(Also the way model are done is terrible, I've never liked it it always got in the way of whatever I was trying to do.)
<span data-bind="text: someVariable"></span>
may look ugly but it is very clear that there is a variable associated to this DOM element.
It took some time getting use to but once I realized how much it made sense I got over it.
So tell me about this universally better way to go.
OutbackJS makes it work like Knockout, but maps onto backbone models (disclosure: I wrote this one). Most of my models in production apps have zero complexity - a url property is usually all that distinguishes them, and outback bindings means that I a) don't have to litter my code with jQuery nonsense, and b) don't really have to muck with models beyond fetching and saving them.
It's an old and trusty way of doing GUI, but it require you to define your UI(views) in two places - HTML and js code. You must have hardcoded HTML references in your JS code(via CSS selectors & etc), and for every change you do in your view you have to check(and probably change) your js code as well - and vice versa.
Where in MVVM based frameworks(e.g. knockout) you define your view only once - in your HTML file. Your view contains everything that is needed to render the data in your View Model, and can initiate changes to the view model(and render any change that is being made to the date in the view model). There is never a need to use hardcoded references to the HTML in your js code.
I have tried most of the data-binding plugins in backbone.. They all fall short one way or the other. Stickit does not deal with collections, model-binder does but is a pain in the ass to use properly. Rivetjs seems better than the other two - but the scariest part of backbone plugins is that the community behind each is extremely small -hence its scary to consider them.