Find a post...

DNN-Connect Blogs

The Future of DNN Speaks Razor - #3 The Death of WebForms

As you might have heard, you have to migrate to Razor soon. Old-school developers have a hard time understanding why WebForms should be replaced, since it's worked to well for more than 10 years. So in this part 3 of my Series The Future of DNN Speaks Razor, I'll explain why WebForms turned out to be the wrong solution for web development and how the web changed to make WebForms' strengths obsolete.

The Truth based on My Personal Experience

My answer is a mix of the official version and by experience. Note that I've refused to adopt MVC for many years now, because in the beginning it was so trivial that there was no benefit in migrating. After a few years it got better, but most features were also available in WebForms, so I still didn't want to adopt it. This changed about 2 years ago after the introduction of Razor (August 2012). Since then, most of our web work was done in Razor (did I say MVC? nope, must have missed that...).

As an important note: I'm still not too excited about MVC, because it contains a bunch of stuff I don't care about. But I LOVE Razor and the WebAPI - and when you combine this with DNN then you will quickly see that the WebForms paradigm is dead. Just to stay focused - again the DNN Roadmap:

Why is a great product like WebForms phasing out?

About fifteen years ago Microsoft tried to deliver Visual-Basic-Style development to the web community. Everything should have been drag-and-drop with smart components doing everything for you. This is why even something trivial as a label (Please Enter Your Name) was made smart - so that you could program against it without knowing HTML. Many things were abstracted so that you wouldn't have to know HTML, CSS or HTTP. It should have felt as if your web-page was always connected to the server (like a VB-Program). It should have just worked. And the server should have been very important for the user experience. To do this, Microsoft gave us things like:

  1. ViewState
  2. Page Lifecycle with thousands of raised events
  3. Postbacks instead of URLs changing when we click a link
  4. Dynamically generated HTML-IDs so the server can keep track of what the browser sees
  5. Event-Binding so the server knows what element was clicked
  6. Code-Behind for the event-programming
  7. Master-Pages
  8. Web-Controls to bundle standalone components
  9. Themes to generate HTML and CSS when some design changed (used to be necessary if you wanted rounded corners)

But the Abstractions Backfired

So first of all this abstraction-concept backfired. It was never possible to create solutions without knowing HTML, CSS and HTTP. To make matters worse, we were actually forced to learn both HTML/HTTP AND the wannabe-abstractions Microsoft invented AND we needed to learn workarounds against the abstractions as they caused a lot of problems. The Viewstate is a perfect example of this - it would have been great, but I wasted so many hours working around the problems created by a Viewstate that it killed all the efficiency gains the Viewstate should have given me.

And the CodeBehind Backfired

Another thing that the classic VB-Programmer got wrong: the Codebehind was the perfect place for quick-and-dirty (and with time: very large and dirty) solutions. Millions of WebForms solution have business logic and data logic in their code behind - because it's so d**n convenient to put it there. This resulted in solutions that never scaled, couldn't be reused and were hard to maintain.

Browsers Became so Powerful That Servers didn't need to Predigest any more

And in addition to the extra complexity that didn't contribute enough value, the web evolved very quickly and became increasingly complex - but not like Microsofts original architecture anticipated. The original design of WebForms expected the server to handle all kinds of scenarios - including adapting to limited device capabilities (screens, touch) and produce optimized HTML for each device. In Microsofts vision this was what each WebControl would have done - but the Web didn't go that way. Today's concepts of responsive webs place all that control in the hands of CSS and Javascript - almost everything takes place in the browser. The pre-chewed-HTML-concept became unnecessary.

You could say that HTML5 makes MVC (any Server-Side MVC but not MVC in general) obsolete.

The Place for View-Logic is now HTML and CSS with a Drop of JavaScript

Let's face it: the choice of server infrastructure is actually becoming less important. Because plain-vanilla HTML, CSS and JavaScript do a great job at creating great looking UIs which are responsive and get things done. And there are so many web-designers and JavaScript-developers out there, that they will solve your problem. So the servers mission has changed. The server of the future must only:

  1. Deliver the HTML containing the content in a structured manner
  2. Deliver additional assets (images, code-snippets, css)
  3. Save data if the user submits a form or something

This is a bit oversimplified, as delivering the right content actually takes quite some work (URL-Routing, database retrieval, security checks, …) and delivering the assets is also complicated (re-sizing, bundling, …). And saving data is also quite some work. BUT it's much less work that originally anticipated 15 years ago by Microsoft. The final straw was when Responsive beat the cr** out of Adaptive.

Here's my favorite Responsive-Quote by Josh Clark, beautifully illustrated by Stéphanie Walter .

And the Web Designers of Today are the VB-Developers of Yesterday…

 And they start with the simple stuff, not the object oriented multi-tier looks-easy-but-is-very-tricky-to-run editions.

In 1995 many programmer-novices got started with Visual-Basic. Thousands of people needed something automated in Word or Excel, wrote their first macros and then went on to build solutions, leveraging their limited initial know-how. Every solution built upon the previous one and became just a little more complex. These people never spent a week to learn a new concept or patterns - it was always "I already know 90% - how do I get this other detail to work".

Today's millions of newbies start with web technologies. They do their baby-steps in JavaScript and HTML. Then they add just one additional feature. They want to leverage what they already know - and a text-based just-add-placeholders-system like PHP or Razor is much closer to that initial know-how than a controls-based abstraction called WebForms.

Because of this, the newbies almost always follow a learning curve which doesn't fare well for WebForms.

In Summary

WebForms must be replaced, because the abstraction failed and actually increased complexity. An a plain-vanilla approach focused on classic technologies like HTML and CSS will succeed, because it's the "natural" way people grow into this topic. But before you say "I knew MVC is better" - wait for the next post showing why MVC failed as well, and why Microsoft is still calling it MVC.... (more in the next post)

With love from Switzerland

Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 600 DNN projects since 1999. He is also chief architect of 2sxc (2SexyContent - see forge), an open source module for creating attractive content and DNN Apps.


PS: Want to get started before the entire Razor-series is out? For the impatient, try the DNN-Razor Host Module and watch this video  or try packaged code apps by installing 2sxc and some of the Razor Apps like the Razor Basic TutorialsList-Tutorials or the SQL and Peta-Poco Tutorials

Daniel Mettler learned programming with the bible translation computer of his parents, deep in the jungles of Indonesia. Since he was only 12 years old at that time and the BIOS only had a version of BASICA, that's what got him started. With 16 he went back to Switzerland and learned German and basic city-survival skills. Equipped with this know-how he founded 2sic internet solutions in 1999 which was focused on web solutions on the Microsoft platform. After a few self-developed CMSs 2sic switched to DNN in 2003 and has been one of the largest partners (17 employees, 700+ projects) in Europe. Daniel is also the chief architect behind the open source 2sxc, a strong promoter of standardization (boostrap, patterns, AngularJS, checklists, etc.) and loves to eat anything - dead or alive. His motto: if the natives eat it, it game.
Peter Donker
Peter Donker  Any post claiming to show how technology X is superior to technology Y is provocative and leaves you open to attacks from all sides. You've mentioned hammers and nails. And indeed, with technology it is very much like this. The right tool for the right job. And even though there may be overlaps, it is rash to just jump out there and tell a community to ditch whatever they're doing and do things the way you do. Webforms was and still is a great fast prototyping tool. You can hack up a web application in minutes that would take you hours if you want to do everything through WebAPI. Really. It's not going away. It will be here for the foreseeable future. For longer than you and other Razor/MV*/XYZ evangelicals have us believe. ASP is even still with us. And you'd be surprised how many sites are still driven by that.
· reply · 0 0 0

Hosting liberally provided by

iJungleboy 10878 88
Geoff Barlow 246 4
Philipp Becker 5231 7
DNN-Connect 426 6
Peter Donker 3990 23
Christopher Hammond 583 2
Olivier Jooris 322 1
Clint Patterson 1 1
Jos Richters 65 1
James Rosewell 213 2
Will Strohl 1401 27
Ernst Peter Tamminga 292 4
Barry Waluszko 858 2
Gifford Watkins 701 9
Torsten Weggen 1301 3