On Scott Guthrie's blog I saw that there is going to be a framework to build ASP.Net applications using the Model View Controller pattern.
What is the Model View Controller Pattern?
The MVC design pattern provides the ability to vary different software components separately. The pattern improves the software robustness and reusability.
The MVC pattern helps the software designer to fulfill the object-oriented design principles, such as the Open Closed Principle(OCP).
The idea of the OCP is that developers must decide early on in the analysis or design phase which parts of the system will be expanded later and which will stay fixed.
According to the OCP principle, the design is extended by adding new code and classes by inheriting existing base classes rather than modifying the existing ones.
Completed and tested code is declared closed, and it is never modified.
Classic design pattern Model View Controller
- Model: Contains and manipulates the data in the program. These are the components of the application that are responsible for maintaining state. Often this state is persisted inside a database
- View: defines how the data of the model is presented to the user; the view forwards received commands and requests to the controller. These are the components responsible for displaying the application's user interface.
- Controller:Defines how the user interface reacts to received commands and requests. These are the components responsible for handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI. In a MVC application the view is only about displaying information - it is the controller that handles and responds to user input and interaction.
The idea is that the Presentation layer (GUI) easily can be switched from for example an ASP.Net web user interface for a windows Forms user interface.
The discussion if this is practical and will be used in real world applications always comes up when discussing this pattern.
When we switch the UI for a Unit test framework, this discussion is almost always turned over in favor for the pattern, because (Unit)testing ASP.Net Webpages can be quite cumbersome at times.
So just for the sake of (unit) testing our code alone this pattern can really add value to our work as developers.
The maintainability of the code should benefit also, because all the layers of our application are really separated and encapsulated.
The ASP.NET MVC Framework will be fully integrated with ASP.NET, which means it supports existing ASP.NET features like forms/windows authentication, URL authorization, membership/roles, output and data caching, session/profile state management, health monitoring, configuration system, the provider architecture, etc.
It will be pluggable and extensible for example: you can optionally plug-in your own view engine, routing policy, parameter serialization, etc.
It also supports IOC container models (Windsor, Spring.Net, NHibernate) for using existing dependency injection.
You can unit test the application without having to run the Controllers within an ASP.NET process (making unit testing fast).
You can use any unit testing framework you want to do testing ( NUnit, MBUnit, MS Test).
I really am interested and will try to follow this, frankly I can't wait to try out a CTP.
My thoughts exactly...