+ All Categories
Home > Technology > Moving from ASP.NET Web Forms to ASP.NET MVC

Moving from ASP.NET Web Forms to ASP.NET MVC

Date post: 13-May-2015
Category:
Upload: kgpainter
View: 4,944 times
Download: 0 times
Share this document with a friend
Popular Tags:
21
Moving from ASP.NET WebForms to ASP.NET MVC - Is it really worth it? Kim Painter @kgpainter [email protected]
Transcript
Page 1: Moving from ASP.NET Web Forms to ASP.NET MVC

Moving from ASP.NET WebForms to ASP.NET MVC - Is it really worth it?

Kim Painter@[email protected]

Page 2: Moving from ASP.NET Web Forms to ASP.NET MVC

What Are Our Choices?

Page 3: Moving from ASP.NET Web Forms to ASP.NET MVC

Strengths of ASP.NET Web Forms over MVC

Provides:

Familiar control and event based programming model

Rich controls that encapsulate HTML, CSS & Javascript

Availability of many rich controls

Browser differences handled for you

SharePoint builds on Web Forms

Page 4: Moving from ASP.NET Web Forms to ASP.NET MVC

The Background of MVC

The MVC pattern was invented in the '70s as part of Smalltalk.

MVC divides your UI into three distinct objects:

the controller, which receives and handles input; the model, which contains your domain logic; and the view, which generates your output.

Page 5: Moving from ASP.NET Web Forms to ASP.NET MVC

Strengths of ASP.NET MVC over Web Forms

Provides:

A "separation of concerns”

Significant control over rendered HTML

Supports Unit Testing, TDD and Agile methodologies

Encourages the use of design patterns by convention

Encourages more prescriptive applications

Extremely flexible and extensible

Page 6: Moving from ASP.NET Web Forms to ASP.NET MVC

Guidelines for When to use Which

By Nick Berardi

Page 7: Moving from ASP.NET Web Forms to ASP.NET MVC

Using a Decision Flow

By Vaibhav Jain

Page 8: Moving from ASP.NET Web Forms to ASP.NET MVC

If We Know There Are Benefits to Learning and Programming With MVC Then Why Don’t We?

Time Challenges/ Priorities

Balancing Life

Page 9: Moving from ASP.NET Web Forms to ASP.NET MVC

Comfort Zone Disinterested/

Apathetic

Page 10: Moving from ASP.NET Web Forms to ASP.NET MVC

Other Challenges

“Many companies have a huge investment in Web Forms technology that they just simply aren't going to throw out - training, third party controls, experience and so on. “

“Many companies don't buy into the whole Unit Test pitch behind MVC. Many companies simply don't test at all.”

Quotes from Mike Brindhttp://mikesdotnetting.com/

Page 11: Moving from ASP.NET Web Forms to ASP.NET MVC

Motivators – Following Words of Wisdoms

If you always do what you've

always done, you'll always

get what you always gotYou can't discover new oceans unless you have the courage to leave the shore.

Page 12: Moving from ASP.NET Web Forms to ASP.NET MVC

Side Benefits

“Developers can grow stronger

by stretching themselves and

learning new ideas and

approaches. “

“Even if you don’t ultimately use something new directly, the act of learning it can sharpen you in positive ways.”

Quotes from Scott Guthrie’s blog on About Technical Debates (and ASP.NET Web Forms and ASP.NET MVC debates in particular)

Page 13: Moving from ASP.NET Web Forms to ASP.NET MVC

Commonalities from the Core Runtime

AuthenticationAuthorizationUser MembershipRole SecurityOutput CachingSession StateConfigurationDeploymentAjaxothers...

Page 14: Moving from ASP.NET Web Forms to ASP.NET MVC

Web Forms & MVC Conversion & Integration

Conversion ProjectSide-By-Side – Preexisting Web Forms appSide-By-Side – New MVC app

Page 16: Moving from ASP.NET Web Forms to ASP.NET MVC

Side-By-Side – Preexisting Web Forms app

http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx

Page 17: Moving from ASP.NET Web Forms to ASP.NET MVC

Side-By-Side – New MVC app

Why?

Keeping rich functionality of some desired server controls – such as the Report Viewer

http://weblogs.asp.net/rajbk/archive/2010/05/11/running-asp-net-webforms-and-asp-net-mvc-side-by-side.aspx

Page 18: Moving from ASP.NET Web Forms to ASP.NET MVC

Common Master Page

Root.master <%@ Master Inherits="System.Web.UI.MasterPage" … %>

MVC.master <%@ Master MasterPageFile="~/Views/Shared/Root.Master" Inherits="System.Web.Mvc.ViewMasterPage" … %>

WebForm.master <%@ Master MasterPageFile="~/Views/Shared/Root.Master" Inherits="NorthwindSales.Views.Shared.Webform" %>

Code behind: public partial class Webform : System.Web.UI.MasterPage {}

Page 19: Moving from ASP.NET Web Forms to ASP.NET MVC

Demo

Page 20: Moving from ASP.NET Web Forms to ASP.NET MVC

So back to the question…

Is it really worth moving from ASP.NET WebForms to ASP.NET MVC?

It depends

Page 21: Moving from ASP.NET Web Forms to ASP.NET MVC

Resources:Comparison Sites:

http://coderjournal.com/2008/12/introducing-aspnet-mvc-part-2-aspnet-mvc-vs-webforms/http://blog.gadodia.net/choosing-between-webforms-and-mvc/http://msdn.microsoft.com/en-us/magazine/dd942833.aspxhttp://www.asp.net/web-forms/videos/how-do-i/choosing-the-right-programming-model

Converting from Web Forms to MVC:http://codingatilivedigitally.wordpress.com/2012/07/10/9-steps-to-switch-from-asp-net-web-forms-to-mvc/

http://www.asp.nethttp://aspdotnetmvc.com/

ASP.NET MVC in Action (1-4)Programming Microsoft ASP.NET MVC Programming Microsoft ASP.NET 4


Recommended