The Model-View-Controller (MVC) is an architectural pattern which separates an application into three main components: the model, the view, and the controller. The Microsoft ASP.NET MVC framework is an alternative to the hugely popular and successful framework of ASP.NET Web Forms for creating Web applications. The ASP.NET MVC framework is a testable, extremely light presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.
The MVC framework includes the following components:
• Models. These are the objects which implement the logic for the application's data domain. It may be noted that more often than not these objects retrieve and store state information for themselves in a database. A student object may want to read its current state from the database, update the “Attendance” property according to the new inputs and then store it back to the database. Though this separation is advisable sometimes you might not use such a physical and stringent form of Model, instead use a data table object to pass information from the controller to the View.
• Views. User Interface is handled by the View component. Typically, this UI is created from the model data. We can use the model sent by the Controller which is called Student and then show a form to the user with an option to update the fields.
• Controllers. This is the heart and soul of the application it is responsible for interaction between model and view, it is the code which chooses the appropriate view and sometimes the logic for server side interaction is written in this part too. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn might use these values to query the database.
MVC as a pattern is nothing new but the implementation created by Microsoft is one of the best solutions around, in a very short span of time this framework has become the weapon of choice for both the novice as well as the experienced. It was first previewed in 2007 and after its release in 2009 it has gone from strength to strength. Given below are the dates of the releases for this framework
The popularity and demand for MVC is so high that many legacy applications written in JAVA and ASP.NET webforms are being re-written using ASP.net MVC. The following chart shows its popularity based on the top 1 million websites data. As you can see the climb is staggering to say the least.
We at XRM
labs were the first company in India which started using this framework
extensively. Couple of our technical leads were the first to get Microsoft
certification related to MVC
Figure 1 source http://trends.builtwith.com/framework/ASP.NET-MVC
Features of the ASP.NET MVC framework
The ASP.NET MVC framework provides the following features:
• Separation of application tasks (input logic, business logic, and UI logic) Separation of Concern is one of the core advantages of ASP.NET MVC . The MVC framework provides a clean separation of the UI, Business Logic, Model or Data.
• Testability, test-driven development (TDD). All core contracts in the MVC framework are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behaviour of actual objects in the application.
• An extensible and pluggable framework. The components of this framework have been designed with goal of easy customization. There is no restriction on the developers and he/she can plug in his/her own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models.
• Extensive support for ASP.NET routing, which is a powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs. URLs do not have to include file-name extensions, and are designed to support URL naming patterns that work well for search engine optimization (SEO) and representational state transfer (REST) addressing.
• Support for using the markup in existing ASP.NET page (.aspx files), user control (.ascx files), and master page (.master files) markup files as view templates.
• Support for existing ASP.NET features. ASP.NET MVC lets you use features such as forms authentication and Windows authentication, URL authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.
Advantages of ASP.net MVC
• MVC Framework is built upon a proven MVC design-pattern. Hence, this is not a new born baby.
• It tries to mimic the "stateless" nature of the web. One big advantage is that unnecessary Session object usage is minimized. URL is the main driver that helps in data maintenance.
• The greatest drawback in ASP.NET is size of controls and view state. View state stores all the data rendered and final HTML. If this information gets too large the application becomes extremely slow on network connection with low bandwidth, fortunately state concept in MVC framework has been completely eliminated.
• Support multiple views.
• Support unit testing as a part of Visual Studio.
Why should you switch?
The million dollar question is that why should your company be concerned with MVC framework. Answer is pretty simple. If you get an application developed in MVC it gives you the freedom to hire two or three specialist. One of them can design your UI without caring about the actual data and servers side implementation while the second developer can create the server side code without worrying about HTML and CSS issues.
If your application has been developed in MVC then adding a new component is relatively easy with no to minimal change a whole new module can be added to your application in future. Thus you are future proved.
All new technologies are now being introduced in MVC thus your application can take advantage of the new features of the web to deliver a rich user experience.
Framework is virtually pluggable with any third party CMS, ERP or CRM. Due to the loosely coupled nature of this framework it does not enforce the requirement of data being a part of the application. Your customer data or existing content can be easily used as Model for the application.
We at XRM Labs pride ourselves in delivering very high end solution using MVC framework. We have experience in designing solutions as varied as time-sheets to full-fledged data analysis application. From simple email control application to a user-friendly CRM for the end user.