Hello All, We are going to start new batch from next week. message/call or mail us for more details.

20 February 2014

MVC Introduction - DotNet Brother

Introduction

ASP.NET MVC is a Web development framework from Microsoft that combines the effectiveness and
tidiness of model-view-controller (MVC) architecture. It is the architectural pattern based on ASP.NET framework which provides a clean and elegant way of developing Web application.

Limitation of ASP.Net Web Forms

Traditional ASP.NET Web Forms development was great in principle, but reality proved more
complicated. Let us discuss some limitation of web forms which are seen as drawbacks:-

View State weight: The actual mechanism for maintaining state across requests (known as View State) results in large blocks of data being transferred between the client and server. This data can reach hundreds of kilobytes in even modest Web applications, and it goes back and forth with every request, leading to slower response times and increasing the bandwidth demands of the server.

Page life cycle: The mechanism for connecting client-side events with server-side event handler code, part of the page life cycle, can be extraordinarily complicated and delicate. Few developers have success manipulating the control hierarchy at runtime without getting View State errors or finding that some event handlers mysteriously fail to execute.

Url: In ASP.NET web forms the request URL points to physical files and the structure of the URL is not SEO friendly. Also, now is the time when URL structure is very important and clean URLs and control over URLs is very much desired.

Code Behind: Code behind model, in my opinion, is the best part of ASP.NET. It provides clear separation of concern. From a developers perspective having the code behind file provides a great way to write the server side logic without having to write code between the HTML markups.

Key Benefits of ASP.net MVC

MVC Architecture

There are three pieces to the MVC architecture:-

The model—The domain that your software is built around. If you were building a blog, your models might be post and comment. In some contexts, the term model might refer to a view-specific model—a representation of the domain for the specific purpose of being displayed in the user interface.

 The view—The visual representation of a model, given some context. It’s usually the resulting markup that the framework renders to the browser, such as the HTML representing the blog post.

 The controller—The coordinator that provides the link between the view and the model. The controller is responsible for processing input, acting upon the model, and deciding on what action should be performed, such as rendering a view or redirecting to another page.

Tight Control over HTML and HTTP

ASP.NET MVC–generated pages don’t contain any View State data, so they can be hundreds of kilobytes smaller than typical pages from ASP.NET Web Forms. Despite today’s fast broadband connections, this economy of bandwidth still gives an enormously improved end-user experience.
Like Ruby on Rails, ASP.NET MVC works in tune with HTTP. You have total control over the requests passing between the browser and server, so you can fine-tune your user experience as much as you like.

Extensibility

The ASP.NET MVC designers set out to give you three options for each MVC Framework component:

  • Use the default implementation of the component as it stands (which should be enough for most applications).
  • Derive a subclass of the default implementation to tweak its behavior.
  • Replace the component entirely with a new implementation of the interface or abstract base class.
Testability
The MVC architecture gives you a great start in making your application maintainable and testable because you naturally separate different application concerns into different, independent software pieces. You can write test scripts that simulate user interactions without needing to guess which HTML element structures, CSS classes, or IDs the framework will generate, and you do not have to worry about the structure changing unexpectedly.

4 comments:

  1. Hi Pankaj,

    Can you write some more topics on MVC.
    Shay Mitti

    ReplyDelete
  2. It is really a great work and the way in which u r sharing the knowledge is excellent.
    Thanks for helping me to understand basic concepts MVC basic concepts. As a beginner in Dot Net programming your post help me a lot.Thanks for your informative article.
    dot net training in velachery |
    dot net training in chennai

    ReplyDelete
  3. I really enjoyed while reading your article, the information you have mentioned in this post was damn good. Keep sharing your blog with updated and useful information.
    .Net Certification Training Gurgaon

    ReplyDelete