What are the use cases for JavaScript MVC frameworks?

When does it make sense to do MVC on the client side?

At the beginning of a new web application project you’re probably going to search around for the latest tools and trends to see what might make sense to use in your new app. I find myself in this position presently. For front end stuff it’s hard to go very far without bumping into Ember, Angular, and other Javascript MVC Frameworks.

The first thing I did (sadly) when I started considering these JS MVC frameworks was research the top contenders, go through the getting started tutorials, and read what others were saying about them to decide on my top pick. I spent days doing this, even seeking advice from brilliant folks like Jeff Atwood before coming to a conclusion. It came down to Ember or Angular and I ultimately decided that Angular was my favorite...which ended up meaning nothing.


What I should have been doing from the get go was looking at my project as a whole and determining whether I even needed a JavaScript framework like Angular. After I decided on Angular, only then did I come to the realization that it made zero sense for my application. The primary reason for this is that my application would be build using .NET MVC. That would mean I would have been applying the MVC pattern to my MVC pattern. MVCMVC as it were. Why would I introduce a routing procedure and view controllers in JavaScript when I already have these things taken care of by .NET MVC?

The part that distracted me from this realization early on was the awesome stuff that Ember and Angular are capable of when it comes to the “M” part of MVC, the Models. Really all I wanted was the nice model pattern that each employed, though they each do it differently. I spent a ton of time reading about the model features and kept ignoring the view controller stuff which might have alerted me sooner. In the end I realized I could just borrow some of the nice model patterns of these frameworks and use them in normal JavaScript to achieve what I wanted.

I’ve seen Angular used in MVC projects before. I can’t imagine using it in an MVC project myself. That got me questioning when a JavaScript MVC framework might make sense to use at all. For every web application that takes any real amount of work we almost universally employ the MVC pattern. What are the scenarios when you would do this on the client side rather than the server side?

One popular application that is built this way is the Discourse forum application. They made the conscious decision to make this an Ember application built on Ruby rather than a Ruby on Rails MVC application. These are smart folks making this decision (Jeff Atwood’s team again) so I’m inclined to believe that I’m missing something. Talking about it with my team, the only use cases we could come up with were A) building an app based entirely on someone elses API or B) building your own app as strictly an API and constructing the client using JavaScript MVC or C) your application is built with Node.js.

What am I missing here? What are the other common use cases for approaching a web application with JavaScript MVC?

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon