Hacker News new | past | comments | ask | show | jobs | submit login

I don't understand this JS MVC thingy, what do they bring up to the table?

I read Backbone's documentation and to me is a mess of heavy JS programming to achieve something that I don't know what it is.

EDIT: How does this mix with Ruby on Rails, Grails or even Java MVC frameworks?




Not sure how you do it, but client-heavy applications that I've written quickly become a huge mess when written in pure Javascript/jQuery, especially when my clients require the app to be single page with no reloading.

Adding something like AngularJS or Knockout far reduces the amount of code you have to write and you get an app written around a data model. Knockout has a good description here:

http://knockoutjs.com/documentation/introduction.html


> I read Backbone's documentation and to me is a mess of heavy JS programming to achieve something that I don't know what it is.

That got me thinking.. Could I ever explain a non-web developer what Backbone is in a succinct way? I'm gonna try..

Web development is basically storing data at the server side, modifying and handling that data on both the server side and the client side. So basically you got multiple representations of the very same thing on two very different mediums. Passing and modifying that representation back and forth between those two very different mediums can be very tricky and error prone by itself, let alone the situation that you're handling varying numbers and varying types of these representations. Now what these MVC frameworks give us are idiomatic methods and structures attacking this very problem of representational hell.


I've been using Angular with Grails for the last 6 months (but these comments would apply to Rails or any other server-side MVC framework) Although we do use Grails MVC to build the Angular-powered HTML pages, the pages are very nearly static HTML. We're using Grails to create a JSON API that the Angular controllers and services communicate with. We are also using the Grails resource pipeline (similar to the Rails Asset Pipeline) for LESS to CSS conversion, .js and .css catenation and minification, etc.

If you're creating "rich" front-end apps (as we are) you will be using your server-side framework mostly for implementing REST services with JSON (or XML, etc) However, you could also use Angular to add new functionality to some existing pages in an existing app.


| I don't understand this JS MVC thingy, what do they bring up to the table?

What MVC brings to any table -- structure and maintainability. This is more geared towards complete client-side applications than your typical jquery plugin.


Would that mean that the backend would be only MC and the client side would be the V using one of those?

Does this question make sense?


Backbone and its ilk are full MVC themselves. Typically, you'd have models on the backend which are synced to the frontend via XHR/websockets/etc, so that both sides have a representation. Backbone also has controllers (in the Cocoa sense rather than the Rails sense), in the form of collections. Unlike Rails, though, most of the functionality is going to be in your views and your models.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: