Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How MVC is better than web forms?

MVC design pattern is better then asp.net web form. Justify with example.

user-image
Question ajoutée par Muhammad Shoaib Hanif , Senior Software Engineer (Team Lead) , Informanagement
Date de publication: 2014/08/06
Hamid Anjum
par Hamid Anjum , Team Lead \ Sr. Software Engineer , University of Business and Technology, Jeddah

Both have their own pros and cons and flavours. MVC is not the replacement of Webforms.

 

1) In terms of development speed, which would be faster: webforms or mvc?

WebForms is faster to develop because it's a lot of R.A.D. development.Using ViewState and strong server controls, developer can develop real world applications with minimal HTML and JavaScript skills.

 

At the other end MVC is time consuming you need to choose it if you are working on really big project/product the expertise you need is you should be expert in HTML, CSS, XML and you should be very good in Client Side Scripting like JavaScript (these are the very important thing you need to know about web technology).And then, you should know about MVC Pattern (supposed you know basic about ASP.NET) You can lookup more closely the MVC Pattern in any Design Pattern Books to understand how it works.

 

How about out-of-box performance between the two?

MVC will perform better in big projects since there is no "extras" being passed between the controller and the View. you only pass what's necessary (IE: no ViewState)

Khalid Omar
par Khalid Omar , Senior .NET Developer / Associate Technology Manager , Musafir.com (Universal Tourism)

MVC is not better than web forms nor web forms is better than MVC. It always depends on what you're doing!

Mohammad Imran Ahmad
par Mohammad Imran Ahmad , Web Developer , Infobahn Consultancy LLC

ASP.NET MVC:

  • Separation of concerns (SoC) • From a technical standpoint, the organization of code within MVC is very clean, organized and granular, making it easier (hopefully) for a web application to scale in terms of functionality. Promotes great design from a development standpoint.
  • Easier integration with client side tools (rich user interface tools) • More than ever, web applications are increasingly becoming as rich as the applications you see on your desktops. With MVC, it gives you the ability to integrate with such toolkits (such as jQuery) with greater ease and more seamless than in Web Forms.
  • Search Engine Optimization (SEO) Friendly / Stateless • URL's are more friendly to search engines (i.e. mywebapplication.com/users/1 - retrieve user with an ID of1 vs mywebapplication/users/getuser.aspx (id passed in session)). Similarly, since MVC is stateless, this removes the headache of users who spawn multiple web browsers from the same window (session collisions). Along those same lines, MVC adheres to the stateless web protocol rather than 'battling' against it.
  • Works well with developers who need high degree of control • Many controls in ASP.NET web forms automatically generate much of the raw HTML you see when an page is rendered. This can cause headaches for developers. With MVC, it lends itself better towards having complete control with what is rendered and there are no surprises. Even more important, is that the HTML forms typically are much smaller than the Web forms which can equate to a performance boost - something to seriously consider.
  • Test Driven Development (TDD) • With MVC, you can more easily create tests for the web side of things. An additional layer of testing will provide yet another layer of defense against unexpected behavior.

 

Mohammad Masadeh
par Mohammad Masadeh , SharePoint Lead Developer , Port Customs And Freezone Corporation Dubai

its totally depend on what u need but there is some advantages for MVC over  Webform for example there is no view state , you can use more than form ,...etc these all advantages in MVC over Webform

Mohammad Shahadat Hossain
par Mohammad Shahadat Hossain , Senior Programmer , Optimal IT Solution

I prefer MVC on web forms. Though it depends on your need.

You can find the answer from these two link:

1. http://www.seguetech.com/blog/2013/12/05/dotnet-web-forms-vs-mvc-which-better

2. http://weblogs.asp.net/ricardoperes/my-view-on-asp-net-web-forms-versus-mvc

 

keep going. Thanks.

shahadat

Deva Gnanam Jayaseelan
par Deva Gnanam Jayaseelan , Lead SSE , MS

It's well explained and discussed @ http://www.codeproject.com/Articles/528117/WebForms-vs-MVC

Javed Ahmad
par Javed Ahmad , Senior Developer , HCL Technologies Ltd

MVC is light weight and secure. It divide project into three part i.e. Model (Data Related Logic), controller ( It work as interface between View and controller) and View. View is User interface

UZAIR AZIZ
par UZAIR AZIZ , Senior Associate Technology L1 , Sapient Consulting Pvt. Ltd.

Below are the points that shows that MVC is much better than Web forms: 1. Performance gain as it do not use the ViewState and calls the controller's action method in place of calling the .aspx page. 2. It provides fully test driven development (TDD) 3. Easy to manage as it follows the separation of Concern methodology. 4. Full control over rendered HTML. 5. There is no page life cycle complication. It is very simple in terms of Get and Post.

MVC is helpful in reducing the problems associated with ASP.net and the problems with ASP.net are  these websites are non-testable and takes more access time than other websites which are developed in other technolgy.

More Questions Like This