Archive for the ‘ASP.NET MVC’ Category

A case for ASP.NET MVC

What is the case for ASP.NET MVC? Lets forget the architecture for a minute and just focus on what it offers me as the developer, or rather what features do the other ASP.NET technologies offer that I do not like using. For starters web forms are ‘heavy’ and not as lightweight as ashx files. ASHX files are lighter because they do not have all the overheads a webform has, but they lack HTML support. The HTML support in webforms sucks because it does not render clean HTML, the tag id’s for instance, and viewstate are examples of ‘unclean’ html. For HTML support in a ashx file you will need to write some code that reads HTML and renders it, plus you will have to do some string manipulation somewhere to place content in the HTML. This seems a bit cumbersome to me. Why cant I have my HTML generated without having to do something like that, but also without worrying about clean HTML. ASP.NET MVC renders clean HTML. ASP.NET MVC Controllers are also available through XmlHttpRequests, making it easy to implement AJAX functionality.

Two reasons to use ASP.NET MVC:

  • Clean HTML
  • Controllers can be called from JavaScript
  • Share/Bookmark

A strategy for using AJAX on ur website

I have been thinking a lot recently about the use (or abuse) of AJAX on a website and it made me think of a strategy to try and adopt. Like all technological things it makes sense to understand the overall business goal first and then to proceed to the next step. It also makes sense not to focus too much effort in one area and neglect others. For instance, too much AJAX and JavaScript will create bigger and bigger .js files, which require more and more maintenance to try and keep small. On the other hand you cannot, not use AJAX, on or in your web applications these days. So whats the best strategy? Well I think you need to understand your business goals, and make sure that what you want to achieve can be achieved. Consistency is often something to strive for in this context, because being consistent is often far tougher than making one or two good impressions. The User Interface (UI) must be consistent throughout any application, rather than be too elaborate.

So to come back to my strategy for using AJAX in web applications, I think an approach I am going to try is to divide navigation into two classes:
*Website navigation
*Page level navigation

Website navigation will generally allow for “postbacks” whereas page level navigation will allow for actions that are very specific for that page. The MVC framework provides a structure that supports this strategy. Your views act as your “postbacks” and the actual views themselves are where the activity takes place. Postbacks in this instance refers to the flicker effect you get when you click on links, whereas AJAX allow for a smoother effect.

The other bit of strategy I would like to think about is processing the results from datasources through AJAX. At the moment I am developing web applications where the web services return HTML strings, and the JavaScript simple ends up displaying it. I feel that this approach is messy and does not allow for a clear and contextualised view of your system. There must be an approach that creates good quality AJAX that can interact with server side code. I am looking for an approach that will make it easier to develop and implement my classes. I love the classical object design approach because I like things organised that way.

  • Share/Bookmark
Get Adobe Flash playerPlugin by wpburn.com wordpress themes