Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why do we need backbone js or any JS MVC framework?

Why do we need to use a JS MVC framework(backbone) if we are already using a backend MVC framework(e.g Django or ROR). I can't understand the concept of two MVC frameworks and how they fit together. I thought all front-end related files or logic(html, css, js) come under the views component of the back-end framework. Can someone explain this in simpler terms?

like image 985
jaykumarark Avatar asked Dec 12 '12 11:12

jaykumarark


2 Answers

Backbone lies in the client [browser], in order to have fast interaction and experience. This way you can take advantage of real-time communication via websockets, or LocalStorage for example.

Using a client MVC [MVVM better, in Backbone's case] implies that you just supply a RESTful set of resource from the server [which you can reuse in many other context], and not a full HTML generation stack.

Said that, client side MVC is closer to desktop/mobile UI-oriented MVC implementations [see Cocoa / iOS] than to web-oriented MVC [Symfony, Django, RoR...].

like image 167
moonwave99 Avatar answered Sep 21 '22 14:09

moonwave99


It's mostly because of scalability, every MV* frameworks allows You to make modular code. To give users high experience by using websites, JS code and some fireworks are necessary. JavaScript gives also posibility to relieve backend side from unnecessary computations and because of these simple facts and the scale of currently made websites (huge amount of modules on backend and on frontend side), such MV* JavaScripts frameworks are made and becomes more and more popular.

like image 23
Wojciech Dłubacz Avatar answered Sep 21 '22 14:09

Wojciech Dłubacz