Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm currently looking into the advantages of using Backbone.js, but I'll be using ASP.Net MVC as the main bulk of the site. My question is, is it worth blending the 2 together or am I making a rod for my own back? Should I just use an ASP.Net Web Forms site instead?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Should I just use an ASP.Net Web Forms site instead?

Not unless you have strict deadlines or other limitations. It's always worthwhile investing time and resources in better technologies like ASP.NET MVC.

As for using backbone.js it will work with any REST API. You can expose a REST API with ASP.NET MVC (and it's a lot easier to do then using ASP.NET winforms)

As long as you expose your data as a service backbone can work with it nicely. Alternatively you can use ASP.NET MVC on it's own and not make use of the client-side MVC backbone offers.

is it worth blending the 2 together or am I making a rod for my own back?

As mentioned if you just use ASP.NET MVC to expose data as an REST API then this is fine. If you use ASP.NET MVC to serve an entire website (including server-side views) then you'll have a lot of code duplication.

However with modern ajax and JavaScript driven websites you will have this code duplication anyway. You might as well use backbone or not use any client-side JavaScript / ajax code.

If your writing a heavy client based website with lots of interactive JavaScript based ui you might aswell use these libraries to structure and organise your code

However if your using backbone.js I would recommend you couple it with node.js to minimize code duplication or couchapp to remove the server-side stack. You don't really need .NET if your using backbone.

share|improve this answer
    
That is great information. So, basically, its better to avoid using Backbone and ASP.Net MVC together if I'm hosting the whole website (which I am) in ASP.Net MVC? Would I be right in thinking that libraries like backbone, spine, knockout etc. are more for other programming languages? –  Neil Knight Aug 11 '11 at 13:31
    
@Ardman that depends. I've made a small edit. this duplication is unavoidable as websites seem to be heavy client / heavy server set-ups these days. If your going to have that js & ajax code anyway you might aswell use those libraries to bring structure and order to your code –  Raynos Aug 11 '11 at 13:39
1  
@Ardman: More like -- decide if your front end will be programmed on the client or on the server. Client MVC + Server Services is fine; Dumb Client + Server MVC is fine. Client MVC + Server MVC Doesn't make sense. –  Sean McMillan Aug 11 '11 at 13:42
2  
@SeanMcMillan Client MVC + Server MVC does make sense. It's just expensive. There are many advantages because you get the best of both worlds (but most of the time it's not worth the cost) –  Raynos Aug 11 '11 at 13:47
    
@Raynos: Fair enough. In my experience, if I'm doing client-side MVC, I'm pumping JSON or XML out of the back end, which doesn't seem to lend itself to MVC very much. I haven't needed to use MVC+MVC Structure, so I don't know much about it. –  Sean McMillan Aug 11 '11 at 14:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.