3

I've been struggling in deciding what direction to go with in regards to the best approach for rendering content to the browser: server side using razor or client side using JSON data and some form of templating (jsRender, loadJson, etc.)

Here's a great article on using client side templating with asp.net mvc: jQuery Templates/View Engines in ASP.NET MVC

ASP.Net MVC 4 has some great toys (WebAPI). I can see creating a suite of WebAPI functionality for delivering JSON data that can be used on traditional web pages and even mobile pages. Really cool stuff.

Then I look at what options you have going with a traditional ASP.Net MVC approach. You have layouts, can take advantage of automatic bundling/minification of JS/CSS files (more ASP.Net MVC 4 goodness), robustness of having ASP.Net MVC available at your fingertips. Really cool stuff.

So, my question is how do you make decisions on which direction you should go architecturally? I suppose you can have a mix bag of approaches within your site, but that becomes a maintenance issue. Going total JavaScript Templates and consuming JSON data from a service is a super clean separation of concerns, but it seems you loose out on a lot of the goodness that ASP.Net MVC offers like routing.

What's the best approach for balancing all of the options available to us?

1 Answer 1

4

This is a bit of a general question, so a general answer is that you should stick to the approach that makes you most productive/gets the job done. Either approach works but of course has tradeoffs. However those usually don't matter that much unless you reach really big scale (e.g. Twitter recently annonced it will move back to server-side rendering for performance reasons). If you're already familiar with MVC and you're working against a deadline - stick to that. If you have more time or want to learn a new technique - go with what looks interesting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.