Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a reason to use a Javascript framework in conjunction with ASP-MVC?

I'm bringing myself up to speed on Javascript, and I'm beginning to wonder if there is a purpose to using a Javascript framework like Backbone/Knockout if I'm already using ASP.Net MVC on the server side.

Since I'm trying to create a single-page browser experience, I can see why having a Javascript framework would be useful in general, but I'm beginning to wonder if I can't create a better experience just relying on AJAX server connections to update the page portions I want refreshed. I guess in general: what is the purpose of a Javascript framework?

like image 842
sircodesalot Avatar asked May 29 '13 21:05

sircodesalot


2 Answers

First off, I would say that nowadays most users expect dynamic experiences as well as responsive interfaces (responsive in terms of speed not the buzzword responsive). To achieve this, using JavaScript is generally the way to go. Usually you save yourself round trips to the server, which take up time and bandwidth.

As far as using a JavaScript framework, and choosing which one to use, that is really going to depend on the type of application you plan on building. For example, Backbone is great at structuring your application, whilst Knockout is great at handing user interaction. There is a bunch more variables that go in to this though, and there are plenty of blog posts which compare and contrast the various frameworks.

You will be hard pressed to get a truly interactive and dynamic web application without using JavaScript these days. The various frameworks will hopefully help you achieve the features you would like.

like image 29
Polaris878 Avatar answered Sep 18 '22 16:09

Polaris878


While there are plenty of advocates for using Backbone and Knockout with MVC (Scott Guthrie was one of them with his SPA sample project), I find it overkill for a lot of my projects.

Lately I've been quite addicted to managing my JavaScript dependencies with Require.Js. It speeds up loading, helps me to modularize my code, and provides some handy uglification. However, at the end of the day, it is up to you to decide how much client-side architectural overhead you need.

As an aside, you may want to consider AngularJS as an alternative to Backbone/Knockout.

like image 69
David L Avatar answered Sep 18 '22 16:09

David L