Search This Blog

Nov 26, 2012


MVC stands for "Model-View-Controller", which is a very old (but still very useful) design pattern. This design pattern will split your application in 3 different parts ("model", "view", "controller"). "Seperation of concern" is one of it´s main benefits.

Short description of these parts:
  • "Model": Represents your application data/model and has no(!) business logic
  • "View": Just display the given viewdata (this could be a normal HTML page or JSON/RSS data)
  • "Controller": The controller represents the business logic and create the view data and send it to a view.
A good example of an MVC application is the web browser.

What is so "bad" about ASP.NET WebForms?

ASP.NET WebForms include many abstractions for the web development. If you are a WinForms developer, you will feel comfortable with it, but if you started with PHP/JSP or just pure HTML and Javascript you will feel very uncomfortable.

The "viewstate" is one feature to hide the stateless nature of HTML, but it can make your web application very slow and makes you crazy. The "WebForms" model include a very complex lifecycle and it´s  important to understand this to work with ASP.NET WebForms.
In my opinion it is too complex and the framework should embrace the nature of HTTP and don´t hide it.

The following are some of the benefits of using ASP.NET MVC.
  1. You get REST URLS like /category/1/7243
  2. You don't have to use the ".aspx" extensions (you never really did, but now it is easier to avoid).
  3. Very clean, controlled HTML output. Less of what will show up is hidden from you, so you have a lot more control over the generated HTML.
  4. Client side code becomes much easier to use since you have more control over the HTML. One problem with using JavaScript with WebForms is that naming containers cause the controls on the page to have strange names.
  5. Testing becomes much easier. Webforms where very difficult to test. Because of the controllers instead of the pages themselves handling things, testing becomes much easier.
  6. It becomes far easier to optimize URLS for search engines. With WebForms one needed to use URL rewriters which merely hid what the real URL was.
  7. With WebForms there was a sense of state. Pages maintained their state between posts. This made things a little bit easier, but this obfuscation hides how interactions between the client and the server actually occur. MVC gives you much more control over the client-server interaction.
ASP.NET Web Forms
  •     RAD
  •     More easy development
  •     Rich controls ecosystem
  •     Familiar as the development approach to Windows Forms development

  •     Clean Separation of Concern (Soc)
  •     Full markup control
  •     Enable TDD (Test Driven Development)
  •     Enable and makes easily REST
  •     More easy client-side integration (Javascript)
  •     Multi View Engine (this is really cool!)
  •     Stateless (No ViewState)
  •     No postback support
  •     Extensible and WEB 2.0 Enabled

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...