views:

64

answers:

3

When you create a new MVC application, how is it different than a Web Application?

I can put a route handler in global.asax even in a Web Application. But an MVC application has more than that, it even has the context menu to create controllers and views.

I am wondering if it is possible to turn an existing Web Application into an MVC application...?

+1  A: 

Basically MVC application IS ASP.NET application. The difference is that it has reference to

  • System.Web.Routing

  • System.Web.Abstractions

  • System.Web.Mvc

dll-s. Also it has some additional configuration in the web.config and a routes registration in Global.asax. The MVC application also comes with default folders for controllers, views and data. It is not mandatory to use the same folders though. You can easily turn existing ASP.NET application into MVC app. For more detailed info you can check this article http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc

Branislav Abadjimarinov
A: 

Hi aximili,

take a look at this good post:

http://stackoverflow.com/questions/267924/how-does-the-mvc-pattern-differ-if-at-all-from-the-dal-bll-design-pattern

MVC is a design pattern which is different especially in UI handling. So if you have an application which has 3 layers UI, BLL and DAL you can still use BLL and DAL. But the UI is very different. MVC design pattern has a model, a view and an controller. So the model is just the object from lets say a person class. The view is the UI the user gets displayed. The big advance is that several views can use the same controller. And the controller checks the correctness of the fields and does your code behind stuff.

So you can reuse your BLL and DAL and have to change your UI of your existing website.

That's the way I got the MVC design pattern.

MUG4N
+1  A: 

I assume you are talking in specific about ASP.NET MVC. So my answer is mostly geared towards it.

ASP.NET MVC is an implementation of the tried and tested MVC design pattern. MVC has been used in the computer software construction for about more than 2 decades but has come into prominence in the last few years. Especially this approach to software construction was popularised by Ruby on Rails. ASP.NET MVC goes along the same lines but adds its own quirks and advantages.

When applying MVC design pattern emphasis is given to clear separation of concerns. Your View concerns are implemented in the views - via HTML, CSS, javascript, View Helpers and ViewModels. Your data concerns - data that will be used and rendered by the views is implemented in your Model layer. Your Controllers facilitate the interaction between your view layer and your model layer, concerns such as retrieving data, updating data, manipulating data etc.

This design pattern might not be suitable for all types of software construction. However, for almost all types of software that requires interacting with the user, MVC greatly simplifies the construction and maintenance of software.

Using the above pattern ASP.NET MVC greatly simplifies web application development. This is made even better with the usage of conventions such as appending 'Controller' in the name of the controllers, Usage of folders for different concerns, URL routing conventions etc.

One benefit of ASP.NET MVC is that it makes working with pure HTML, CSS and javascript easier. It also does away with Viewstate and any performance limitations associated with it.

Bikal Gurung