To try to overcome this situation several frameworks have come up. They’re the so-called MVVM Frameworks. Knockout is one of the main examples.
Using Knockout the separation of concerns becomes neater, helping developers to organize and structure better their code.
On one hand it’s very true or at least, in my opinion, Knockout is not simple to catch up with. It introduces new syntax and concepts like dynamic binding between Models and Views. On the other hand, the benefits are worthwhile.
The previous example shows a ViewModel (kind of objects use by Knockout) with some properties and functions.
The real advantage that Knockout offers is that every time the model changes the view does as well. And what’s more, this happens writing much less code than before. So if you do not believe me just copy and paste the code above and run it in your favorite browser. You will discover the magic of Knockout.By Eugenia Pérez by