What is ASP.NET MVC?
ASP.NET MVC is fairly new, and is used for creating websites with the help of HTML, CSS and .Net. MVC stands for Model View Controller. This, however does not replace any existing formats, it is just a format the developers can use to make websites. There are three programming models for ASP.NET MVC –
As per the MVC model, there are three different logic layers.
- The business layer, which is known as the model logic
- The display layer, which is known as view logic and
- The input control, which is known as controller logic
More about MVC model and its advantages
The business layer/the model is the application that looks after the logic part of the data, while the display layer or the view part looks after the display side and the controller or the input logic looks after the interaction aspect within the application. The basic advantage of the MVC model is that the developer can concentrate on each aspect separately or decouple them.
The view or the display part understandably looks after the UI or the user interface. Have you seen the edit view that displays a number of features like the text boxes, check boxes, drop-down list and so on. This UI is made from a model data. The controller on the other hand looks after the user inputs part. It is also the main part of the MVC architecture.
Controller has a software code that lets the developer control the interactions between the first two – the view and the model. Additionally, it receives all the requests sent in by the user and works with the model logic, which is also the lowest level in the pattern and is thus responsible for handling the data, to create data as requested by the developer.
Advantages of ASP.NET
ASP.NET framework is a built-in windows authentication and integrated with a per-application configuration in order to keep the applications secured. It is the most popular server-side technology and hence, the code itself runs on the windows server before it comes on the web browser.
- The development part is simple and easy to maintain.
- As it is part of .Framework, you can quickly access all the .Net Framework features
- If you want to develop large applications, then you don’t have to use long line of codes
- .NET is language independent, so the developers get the freedom to choose any programming language that they find easy to work with
- With ASP.NET, it is possible for the developers to mix HTML code and ASP code and create dynamic web pages
- ASP.NET is integrated with built-in security features
- Integrated with ADO.NET as well
- ASP.NET has another noted advantage; it alerts the user of illegal behaviors like unbounded loops, memory leaks and so on
- It is possible to get high level performance, thanks to its features like JIT compilation, caching features, native optimization support, early binding and more
- The program maintenance part is a piece of cake because the program logic and content can be separated
- It is equally easy to deploy ASP.NET because you no longer have to register components as it is all built-in
- The execution speed of ASP.NET is very fast
- If the developer wants to develop program logic, then he has the option of more than 25 .Net languages to create the code
Advantages of MVC at a glance
MVC Framework is definitely not new and is built upon a proven MVC framework. Its features are as follows:
- Its views can be nested and it supports nested views with a subclass of View – CompositeView class
- The developer has the freedom to change the way a View responds, for example, response to the keyboard can be in the form of pop-up menu, using command keys and so on
- With MVC, you can attach several views to the model and create different presentations; that means, it allows for view/model decoupling
- MVC supports unit testing; for Visual Studio 2008 and 2010
No more load time delays; so perfect for people with slow internet connection
Comparison of MVC to older ASP.NET Frameworks
- ASP.NET Web Forms make use of controller pattern approach for layout rendering. This allows for the developer to have separate controller for each page. ASP.NET MVC, on the other hand uses Front Controller approach to process the requests.
- Tightly coupled concerns for ASP.NET. But for ASP.NET MVC, the separation is quite evident; you have View and Controller
- Automated testing is literally impossible with ASP.NET. This is easily possible for ASP.NET MVC
- Viewstate is used to achieve the concept of stateful behavior in ASP.NET. But the concept of viewstate is totally unheard of in ASP.NET MVC. This means it is easier to load the pages in this than in ASP.NET format.
- Page Life cycle format followed ASP.NET. This is fairly simple in ASP.NET MVC model
- ASP.NET is perfect for small scale applications, and ASP.NET MVC leans towards large-scale applications.
Should you shift to MVC – and why?
Pictures: Flickr.com/ Adam Kinney/ Alan Dean/ Uri Baruchin
The author: Reema Oamkumar is engaged as a thought leader at Software-Developer-India.com which is a part of the YUHIRO Group. YUHIRO is a German-Indian enterprise which provides programmers to IT companies, agencies and IT departments.