microsoft asp.net webforms vs. mvc

9
WebForms vs MVC Stupid Web Technology Moves Too Damn Fast

Upload: warren-thompson

Post on 15-Dec-2014

10.583 views

Category:

Technology


0 download

DESCRIPTION

Comparing the potential migration of a commercial software application from Webforms to MVC

TRANSCRIPT

Page 1: Microsoft ASP.NET Webforms vs. MVC

WebForms vs MVCStupid Web Technology Moves Too Damn Fast

Page 2: Microsoft ASP.NET Webforms vs. MVC

*** Web 3.0• I was brought on board 8/2011

• Discussion/architecture continued until 10/2011

• Our platform consists of • Web Forms with Custom Web Parts

• Open Source Grid/Layout/Window plugins

• Challenges we faced• Localization of client side script

• How to take advantage of ***’s awesome biz architecture

• How to support licensing/authentication through a state-full architecture

• How to organize client side code in a meaningful efficient manner

• How to create rich UI widgets in HTML 5 that have “near native” performance

Page 3: Microsoft ASP.NET Webforms vs. MVC

Our Choices• Localization:

• Uses AJAX ScriptManager and embedded JavaScript files in web part assemblies

• Biz Architecture• Created a Service Oriented Architecture on top of the *** biz layer using Windows

Communication Foundation. All client side interactions are handled through AJAX calls to these services.

• Authentication/Licensing• Handled by shuffling a cookie containing “auth” object from web application to client side

JavaScript and back to web service. User is authenticated via cookie through two separate app domains.

• Client Side Code Organization• Each main UI element is encapsulated in it’s own “web part project” in the UI layer under

***.UI.Web.*. Each web part is embedded with it’s own HTML/JavaScript/CSS resources, and injected into the site via the web forms script manager. During injection ScriptManager can handle things like localization.

• UI Widget• Used the open source plugins DataTables, AeroWindow, and jQueryLayout

Page 4: Microsoft ASP.NET Webforms vs. MVC

Our UI Framework Alternatives Were Not Ready…• KendoUI/IgniteUI were both in infancy

• IgniteUI was previously called NetVantage for jQuery

• Neither had a stable grid component that supported the advanced functionality we required.

• These features did not yet exist per the Netvantage jQuery 2011.2 document:• Column resizing/reordering

• Item previewing

• NetVantage’s grid had a list of 27 known bugs, 7 of which had no workaround and were never fixed.

KendoUI

Page 5: Microsoft ASP.NET Webforms vs. MVC

Microsoft Also changed the Web Service game…• At the time, WCF or traditional ASPX web

services were the only way to create RESTful web services

• WCF is a pain in the ass.

• WCF REST is an extra hard pain in the ass.

• WCF REST with both windows authentication and anonymous authentication is the most unbelievably largest pain in the ass imaginable.• Plus it ruined my Disneyworld trip.

• Help was around the corner – Two project promised to simplify RESTful services:• WCF Web API:

• http://wcf.codeplex.com/wikipage?title=WCF%20Web%20API%20is%20now%20ASP.NET%20Web%20API

• WCF REST Starter Kit:

• http://aspnet.codeplex.com/releases/view/24644

WCF

Page 6: Microsoft ASP.NET Webforms vs. MVC

Microsoft Also changed the Web Service game…• Microsoft was very awesome. :-/

• They decided to replace WCF REST API with MVC Web API

• As always – the story is that WCF REST has very viable use cases blah blah blah… *cough* Silverlight *cough*

• Web API was released Aug 2012 – about halfway through our development cycle.

• MVC itself was in Version 3 when we started – Version 4 was released Aug 2012, and Version 5 is currently in preview.

WEB API

WCF

Page 7: Microsoft ASP.NET Webforms vs. MVC

Other technology that has popped up over the last two years

• SignalR/WebSockets

• TypeScript

• SASS/LeSS

• NodeJS

• NuGET

• GitHub

• 5 gazillion JavaScript frameworks

• Native JS Development (Windows 8, Google Apps)

• ShadowDOM

• Web Components/Polymer

• HTTP 2.0

• SPDY (IE11 supports!)

In Use Today Around the Corner

Page 8: Microsoft ASP.NET Webforms vs. MVC

Web Forms vs. MVC

Web Forms

• Great UI encapsulation

• Localization through RESX/ScriptManager

• Poor web development practices• ViewState

• Single Form per Page

• Slows development – very difficult to order JavaScript/CSS/HTML in the most efficient manner.

MVC

• Ex Ruby staff

• UI encapsulated only through JS files – not separate projects

• Localization through JSON

• Thin HTML – no extra hidden elements/ViewState/random Microsoft garbage

• All of the new Visual Studio tooling is being developed with WinForms in mind – i.e. web essentials doesn’t have a way to preview/reference files from an embedded assembly.

Page 9: Microsoft ASP.NET Webforms vs. MVC

In Summation• I’ve developed a healthy hatred for the Microsoft

platform

• I also like some really cool things about the new Microsoft platforms.

• But those really cool things will probably be replaced in a year or two.

• MVC is a very cool way to develop• Except for it abandons the way Microsoft has built web software for over

10 years.

• And it also does not integrated with Microsoft Web products like SharePoint, which will remain web forms based for years to come.

• It is more closely related to every other web platform out there, like PHP, Ruby, Java Server Pages (JSP), etc.

• MVC is a faster, more web oriented, and a less bug prone method of developing.

• I don’t have to spend time digging around in viewstate

• JavaScript isn’t parsed through web handlers

• Web toolsets like Google Chrome are easier to use.

• We are prepared for the transition – MVC was on the radar, and all of our web parts will built with the concept of one day transitions to MVC in mind.

• No server side DOM

• No ViewState

I ran out of time building this PowerPoint – here’s a picture of a kitten petting

a duck