News for hackers. Stuff that matters.
Re:Ask HN: Angular/Knockout/Ember, logic in templates, and m... by hasenj on Thursday August 30, 2012 @02:10PM (#4455917)
I never found merit to the point about not putting logic in templates.

The impressive feature of knockout (and angular) is automatic updating of UI when model data changes.

Knockout calls it "viewmodel", that is, the model is not necessarily your data model (though it could be!) but rather it's a model for the view: the state of the viewmodel determines the state of the UI.

Why would you say that this is wrong?

It even has a wikipedia page: http://en.wikipedia.org/wiki/Model_View_ViewModel (not that this matters, but it's a counter argument to "it's not standard").

Re:Ask HN: Angular/Knockout/Ember, logic in templates, and m... by rudasn on Friday August 31, 2012 @04:06AM (#4458763)
I love the idea of viewmodel and automatic UI updates! What I don't really like is the implementation of that concept by these three frameworks.

For example, from Knockout's homepage: http://knockoutjs.com/img/homepage-example.png

That mixing of HTML and JS variables (in data-bind: chosenTicket, tickets) and behavior (click: resetTicket) looks very alien to me. It just doesn't feel right.

It does make automatic UI update very very easy to implement but at what cost? Is code like this maintainable? Is it easily testable? Does is scale well?

Re:Ask HN: Angular/Knockout/Ember, logic in templates, and m... by hasenj on Friday August 31, 2012 @04:34AM (#4458828)
Haven't used knockout heavily yet (but I plan to!).

From what I can tell (mostly by intuition and experience), this looks at least more maintainable than typical MVC systems like Backbone.js

Re:Ask HN: Angular/Knockout/Ember, logic in templates, and m... by countessa on Friday August 31, 2012 @03:18AM (#4458670)
in fact, asp.net mvc is more of a MVVMC framework, so it's used server side as well.