Udostępnij za pośrednictwem


ASP.NET MVC and JSON and when do you use Async

I wanted to post somewhat of a discussion starter around some of the new technologies that ASP.NET has recently released.

ASP.NET MVC

This technology has one huge benefit of allowing you to do unit testing on your site.  But there are also a number of other advantages to it, for example, you can have a web page call commands inside a controller.  This allows multiple pages to call the same command which helps keep things clean.  It also does a pretty good job of separating the code from the presentation layer.  But I did find myself doing a lot of coding like I used to with classic ASP or even IDC where we loop through results and have <%= %> snippets all over the aspx page.

JSON/AJAX

These technologies have really opened the door to a lot more asynchronous commands on the web.  They allow you to do lots of small submissions and updates without the need to submit and refresh the whole page.

jQuery

This is a really interesting new functionality in that it really isn’t anything new but just a way of collecting things in a cleaner way.  The way it is designed really gives us an ability to do things that you generally don’t consider doing.  For example, you can make images clickable without having any link code in the html.  It can also give some interesting ways to hide some of your IP (although they can always see it using something like netmon).

Silverlight

I think with Silverlight 3, we have really raised the bar for making Silverlight a choice for developing an application.  Especially if you combine it with RIA, there are a lot of great applications of Silverlight that before would be much harder to create.  I know Silverlight 3 is just in developer beta, but I have been using it quite a bit lately and I think it is really going to change things.  The deep linking and search engine optimization functionality really help make this a good solution as well.

So when would you use which?

That is what I’d like to hear from everyone.  If you have a page, when do you decide that you should do something async?  When do you decide that you should just submit the entire page?  Have you considered using Silverlight yet?  What functionality makes it attractive to you?  Is it the off-line functionality?

My take

I wanted to give some of my thoughts on these things, but remember that they are just thoughts as a lot of these technologies I haven’t used enough to know which is best for what situation.

I think that most of these technologies allow for very fast creation of a site.  I think a lot of it boils down to what you are comfortable with or what you have available.  If you have designers at your disposal, Silverlight is a great choice as they can create the Xaml to make your application look amazing.

I think one of the powerful things about MVC is that you can combine it with AJAX, jQuery, JSON to get a bunch of these things in the same application.  But it still is a question as to when to use what.  For me, I really like using jQuery to control the UI and then have it call commands through AJAX/JSON.  It also allows you to update a page with new content without having to refresh the page.  Which makes the user experience a lot cleaner.

As for Silverlight, in general I think it is a wildcard out of the bunch.  You can do all the same things you can with these other technologies but within the same framework.  So I think if you want to have the best of all worlds and learn the smallest amount, this may be a good way to go.

 

So what are your thoughts?  And do you have any other functionality that you would like that see that isn’t available yet?

Comments

  • Anonymous
    April 03, 2009
    PingBack from http://sovit.biz/aspnet-debugging-aspnet-mvc-and-json-and-when-do-you-use-async/

  • Anonymous
    April 04, 2009
    Interesting Finds: April 4, 2009

  • Anonymous
    April 06, 2009
    Interesting, though if accessibility is of concern, you'd need HTML and some unobtrusive Jquery/Javascript.

  • Anonymous
    April 07, 2009
    I've done the whole asp.net mvc, jquery, ajax, etc... thing... And I think if I ever get the chance again... I'd go with Silverlight. There are many issues, ie. browser compatibility, hard to debug, hard to catch javascript errors.  Let alone the wide variety of knowledge you must know to build an app: web, ajax, css, jquery, mvc lifecycle, javascript I think it can seem rather simple at first, but as the application complexity goes, it can be daunting.