InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Model-View-Controller framework for ASP.NET in the works

Posted by Hartmut Wilms on Mar 17, 2007

Sections
Development
Topics
.NET ,
.NET Framework
Tags
ASP.NET
At the MVP Summit Scott Guthrie presented a prototype for a Model-View-Controller framework, which might make its way into ASP.NET, in a special meeting arranged by Jeffrey Palermo.

The Model-View-Controller framework is centered around the Controller. In the Java world Struts is a very popular example of an MVC Web Application Framework. The general idea is that the controller is responsible for the navigational code, i.e. it controls the application flow. The view simply renders the information stored in the model. Although MVC provides a certain level of separation of concerns, the view is often tightly coupled to the model. On the other hand the application flow is separated from the view, thus providing better means of reusing views as well as a cleaner web client implementation.

Jeffrey Palermo describes how the MVC framework prototype works:

With Scott's prototype, there is a new handler factory that infers from the URL which controller to instantiate and load. The controller then decides what to do with the request. The controller can load a view (.aspx file) and let it render. The view can access properties of the Controller. The ASP.NET lifecycle and control model and still be used in the view, or you can let the Controller render a view of customized templates. Either way, the Controller is in control.
Besides supporting separation of concerns, MVC allows for an easy way of unit testing web clients. The flow of actions can be tested without instantiating (real) views; mock views can be used instead.

Joost gives some explanation of the Model View Controller pattern in web applications in his article, also naming the pros & cons:
  • What's so useful about it
    • Separation of requests and pages
    • Views are dumb
    • Shielding of the Model implementation

  • Problems and limitations
    • What goes where
    • Coupling between View and Model
    • Lots of objects
Today the Model-View-Presenter pattern is used for separating model, view and application flow in the ASP.NET world, e.g. in the Web Client Software Factory. Sometimes MVP is seen as an improvement of MVC, making use of its strengths and at the same time avoiding its disadvantages. Martin Fowler provides a nice overview of current GUI Architectures. Within the article he explains the different paradigms for developing GUIs:
To approach MVP I find it helpful to think about a significant mismatch between two stands of UI thinking. On the one hand is the Forms and Controller architecture which was mainstream approach to UI design, on the other is MVC and its derivatives. The Forms and Controls model provides a design that is easy to understand and makes a good separation between reusable widgets and application specific code. What it lacks, and MVC has so strongly, is Separated Presentation and indeed the context of programming using a Domain Model. I see MVP as a step towards uniting these streams, trying to take the best from each.
Concerning the value of the MVC framework for ASP.NET Jeffrey Palermo concludes:
This is very cool, and ScottGu is headed in the right direction. I'll vouch for that. We're going to end up with a new ASP.NET paradigm that so much easier to work with and, most importantly, easier to test!
What are your experiences with Web Application Frameworks, the MVP or MVC pattern and what do you think of MVC for ASP.NET?
Monorail??? by Rob Eisenberg Posted
Re: Monorail??? by Hartmut Wilms Posted
Re: Monorail??? by Ricardo Redder Posted
Re: Monorail??? by David Li Posted
Re: Monorail??? by Jeff Santini Posted
Re: Monorail??? by Hartmut Wilms Posted
Is this the new Rails-style framework people have been whispering about? by Obie Fernandez Posted
  1. Back to top

    Monorail???

    by Rob Eisenberg

    Sure. This is moving in the right direction. However, it's still another layer built on top of a poor abstraction. Why not just use Castle's Monorail. It already has all of these features plus tons more. It's tested and proven in the field. It's going to take MS several years before it can catch up with what is already available TODAY in open source frameworks (Castle-Monorail, NHibernate, MbUnit, RhinoMocks, etc.)

  2. Back to top

    Re: Monorail???

    by Hartmut Wilms

    You're right. Monorail is surely a great framework. But this opens another completely different discussion. The same question might have been asked (and was) concerning NUnit, MbUnit, Log4Net, and several other great OSS tools.

  3. Back to top

    Re: Monorail???

    by Ricardo Redder

    Definitely Castle is the best framework available for .NET, but it still needs lots of improvements, even though... it's great, and it does MVC, as well as many other things.

  4. Back to top

    Is this the new Rails-style framework people have been whispering about?

    by Obie Fernandez

    I heard at QCon from someone high up in the dark empire that it might be codenamed Blink...

  5. Back to top

    Re: Monorail???

    by David Li

    The reason is because in a lot of high level corporate environments, open source products are no-no.

  6. Back to top

    Re: Monorail???

    by Jeff Santini

    But in alot of others they are not. Certainly in the Java world I have never worked on a project in a big corporate environment without some OSS. Hibernate, Ibatis, Spring, Webwork, Freemarker, Velocity are all de rigeur in the high profile Java projects I have been associated with. Have also been involved with NHibernate and Neo being used in .Net projects

  7. Back to top

    Re: Monorail???

    by Hartmut Wilms

    The main reasons for .NET OOS tools being rejected by "big companies" are that the Microsoft community's activities in the field of OSS development has been weak in the pre .NET era and that Microsoft provides tools on their own instead of supporting the OSS frameworks.
    Sun supports Java OSS development, e.g. they are supporting Tomcat as a reference implementation for some of their J2EE specs. There are reasons for both the Microsoft and the Java way of handling OSS development.

Educational Content

Jesper Boeg on Priming Kanban

In this interview, Jesper Boeg, author of the new InfoQ book – Priming Kanban, discusses the keys to using Kanban effectively, and how to get started if you are currently using other approaches.

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.