Question

In addition to being a 30 year pattern, MVC was never meant for current applications. MVP was its successor and designed to handle event based apps coming out in the 90s. Passive View and Supervising Controller seem to have risen to the top. For those two, it almost isn't necessary to talk about MVC/MVP.

Specifically, is the controller action in ASP.NET MVC that brings back a view creating that view? In MVC, the controller doesn't create views or talk back to them. How accurate is it to call ASP.NET MVC an MVC implementation? Or, what would be an accurate name for it?

Was it helpful?

Solution

I think it's Ruby on Rails that inspired MS to create asp.net MVC.

OTHER TIPS

ASP.NET MVC is simply Microsoft's acknowledgement of the success of MVC implementation within web frameworks like Ruby on Rails and Django. The realization that many web developers would like a more hands on approach to web development which embraces the "opinionated" programming model (convention over configuration) and strays away from the stateful abstraction that ASP.NET WebForms provides.

Is it an exact implementation of the Smalltalk MVC pattern? No. Is it a result of panic? No. Is it a result of the success of both Ruby on Rails and Django? Yes.

I happen to love this model as it embraces the rich framework provided by .NET and the ASP.NET stack while remaining minimalistic in approach and use of convention based development.

Close enough, and it's a sales strategy.

They sell ASP.NET against other technologies that identify themselves as MVC. So it's competitively useful to name it to be perceived in the same category.

Microsoft wins more often by product positioning than by accurate technology identification. (Plus long-term delivery, IMHO.)

ScottGu eludes to the answer in the first part of his post on the first MVC demonstration here. The short answer is that people asked for it and Microsoft decided to go with it. It fits with the current .Net model for adding as many options as possible, allowing the framework to reach a bigger target market, and also provide developers with the right tools for the right project.

MVC as implemented by ASP.NET MVC isn't the MVC pattern of old. In what I'll call "classic" MVC the View has direct, but read only, access to the Model, in ASP.NET MVC it's considered bad form to access your business model directly from the View. What you end up with is something very much like Supervising Controller + Passive View:

public class MvcExampleController : Controller
{
    public ActionResult ActionMethod(BoundInputData inputData)
    {
        var results   = DoActualWorkInTheModelWith(inputData);
        var viewModel = CreateViewModelFromThe(results);

        return View(viewModel);
    }
}

To me this looks more like a Supervising Controller than classic MVC. Once the work gets done in the Model, the view gets passed a ViewModel (aka PresentationModel). The ViewModel generally has a 1 to 1 relationship with the UI elements in the view and may or may not look anything like the objects in the actual Model. A View that acts on a ViewModel and not the actual Model smells alot like a Passive View to me.

I won't get into whether or not this is a "real" MVC implementation or not, but if your argument is that ASP.NET MVC doesn't use modern web design patterns I have to disagree.

Best guess, everyone's heard of MVC. MVC has been beaten in as a "best practice" for quite awhile, and thus a whole generation (or two, or three) of developers see MVC and think happy thoughts.

Also, plenty of other frameworks espouse MVC in a similiar light so Microsoft probably feels compelled to do likewise.

In short, I doubt very much that there's a strong technical reason for it.

You can roll your own MVC with the current ASP.NET framework and still keep the postback model.

http://www.codeproject.com/KB/aspnet/RollingYourOwnMVCwithASP.aspx

This is a great question, a lot of people have asked this question in the early days of MVC. Here is the answer from Phil Haack one of the lead developers on the project!

http://haacked.com/archive/0001/01/01/everything-you-wanted-to-know-about-mvc-and-mvp-but.aspx

Check it out, read the links and go from there.

Also, an answer to the debate maybe S#arp Architecture. They have built a layer on top of MVC to make it act more like MVP. Check them out if you're looking for soemthing along those lines.

Good luck!

I think this was more of a "panic marketing decision" then a technical decision. RoR was stealing markets every second and MSFT completely panicked, so MSFT felt they had to deliver something which gave them the opportunity to get some of the hype back to "their camp" again...

Also they needed to help their developers gain bac teir self-respect again by getting to associate this hyped word with themselves so that the .Net Developers could look themselves in the mirror again without feeling ashamed for that they didn't know MVC since their platform of choice didn't deliver this kind of pattern for them (out of the box)

For a medium skilled (.Net) developer it's really difficult to not feel like a dinosaur when a medium skilled RoR developer fires up rake and creates a spike in less then 15 minutes having a working and running proof of concept before the .Net developer even is finished starting vstudio.exe... ;)

I guess it's a controversial standpoint, but it's mine and I'll defend it till the bitter end ... ;)

There are countless examples today of that yes, MVC and scaffolding will give you an initial speed boost, yes. But for maintainability, code reuse, encapsulation and mostly every really important thing - MVC just isn't the "silver bullet" and most of the times WebForms are far superior in the long run (unless used like toilet paper of course)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top