The Four Pillars of ASP.NET

Not that long ago, there was just ASP.NET. But ASP.NET has expanded to include different approaches to development. Recently, I was chatting with Microsoft’s Scott Hunter and Steve Walther over drinks at DevConnections Orlando and Steve mentioned “the four pillars of ASP.NET.” The four pillars are the four ways you can build web sites with ASP.NET, both today and in the future. The four pillars are:

1.       ASP.NET Web Forms. Until recently, this was the only pillar of ASP.NET. Everything was done using the familiar rich server-side controls that many have grown to love (and some have learned to despise which is the seed for the other three pillars).

So what’s wrong with Web Forms? Well, many developers believe that ASP.NET Web Forms are too much of a black box with a healthy-dose of black magic. There’s a price you pay for the Web Form event model and lifecycle and that price is control over the exchange of data between server and browser. Some say the Web Form model with its incessant ViewState is a pig. The Web Form model also makes it difficult to create testable applications and practice test-driven development (TDD). On the other hand, ASP.NET AJAX and ASP.NET MVC (pillars 2 and 3, respectively) come with a steep learning curve, and for many developers will take longer to develop the equivalent application. Pillar 4 (Dynamic Data), on the other hand, has limited applicability, IMO.

My opinion is that with the possible exception of Dynamic Data for the creation of simpler intranet applications, nothing in my mind beats ASP.NET Web Forms (especially when paired with the ASP.NET AJAX UpdatePanel control) for creating good, solid, and responsive applications that, while not the leanest and meanest of applications nor very testable, are easy to grok and master for the novice through advanced developer. Web forms are also the best match for the developer looking to make the move to ASP.NET from Microsoft desktop (Win Forms or WPF) development. And with each new version, Microsoft is making it easier to tame the pig (ViewState) and reduce its size: ASP.NET 2.0 introduced ControlState and ASP.NET 4.0 changes the inheritance model of ViewState so it will be easier to turn off ViewState by default and only turn it on when needed.

 

2.       ASP.NET AJAX. This pillar came to life with the ASP.NET AJAX Extensions for ASP.NET 2.0 / Visual Studio 2005. ASP.NET AJAX is now integrated into ASP.NET and Visual Studio 2008 and consists of both a set of server-side controls as well as the AJAX client-side libraries. In regards to its existence as a “pillar,” I would argue that Microsoft is really only talking about the client-side of ASP.NET AJAX. The reason I say this is that the Upgrade Panel and other server-side AJAX controls merely extend the Web Form pillar, giving Web Form controls the ability to do asynchronous postbacks.

There are many in the hard-core ASP.NET AJAX community that believe that a true AJAX application needs to be built from the ground up without the use of Web Forms and the server-side controls. Using this approach, ASP.NET merely becomes a way to emit HTML with embedded JavaScript (and references to the Microsoft ASP.NET AJAX and JQuery libraries) that calls back to ASP.NET (or WCF) web services. When the HTML and JavaScript hit the browser, that’s when the action begins.

The promise of this approach is a much snappier user interface and a much more scalable web site. On the downside, this requires programming in a loosely-typed language with a weird inheritance model, spotty support for IntelliSense, and, while improved, lousy debugger support. Another downside, the lack of smart client-side controls is likely to be remedied in the ASP.NET 4.0 timeframe. Microsoft is busy improving the client-side story, complete with client-side controls, for ASP.NET 4.0 (if you are curious, check out
http://asp.net/ajax and click on the “ASP.NET AJAX Preview on CodePlex” link for a peek at what’s coming). Regardless, I believe this pillar will always be for a subset of ASP.NET developers who don’t shun the client-side.

 

3.       ASP.NET MVC. This pillar is the newest to emerge from Microsoft. In fact, as of this writing, it’s only a couple of weeks old, having been released at Mix09. Some ASP.NET curmudgeons would call this a throwback to the days of ASP “classic” spaghetti code, but for many others--especially the alt.net crowd and transplants from Ruby and Java--this represents the cat’s pajamas on the Microsoft web stack. (Of course, it’s amazing how quickly developers find problems in the latest programmer’s paradise--usually before its release--and I’m sure the MVC aficionados are already looking to the next release.)

The basic idea behind ASP.NET MVC is to separate out the three concerns of the MVC pattern: the model, view, and controller. The model represents the data model, the view is the user interface that presents the data and interacts with the user, and the controller is the command center that takes inputs from the view, pushes and pulls data into/from the model, and decides what to do next. By separating out these concerns (as purely as possible), you improve the ability to create unit tests for your applications and, at least on some level, improve application maintainability. If you are into test driven development, then this is the pillar to hook your horse to.

 

4.       Dynamic Data. IMO, Dynamic Data is a misnomer. From its name, one would tend to think this is yet another data access technology from Microsoft. It is not. I would have preferred Microsoft to use the name Dynamic Application or Dynamic Application Builder. MSDN Help says, “ASP.NET Dynamic Data is a framework that lets you create data-driven ASP.NET Web applications easily.

You start with Dynamic Data by creating a database and then using either LINQ to SQL or the Entity Framework to create a model over your data. Next, create a new project or web site in Visual Studio 2008 (with SP1) using one of the Dynamic Data Web Application templates, make a fairly simple change to the web site’s Global.asax, and Visual Studio builds a dynamic ASP.NET application over your data model. The resulting site support the creation, retrieval, updating, and deletion (commonly referred to as the CRUD operations) of rows in the underlying database.

Dynamic Data uses what is termed dynamic scaffolding to construct your application. This means if you change your data model, the application will be instantly updated: there’s no code that needs to be re-generated.

Dynamic Data is customizable. Thus, if you don’t like how Dynamic Data presents a datatype or a particular field, or want to change how it performs validation of a field, you can change the templates behind these. You can also change the master page used as well as a number of other details.

Kudos to Microsoft for Dynamic Data--even though I hate the name. Just realize that this pillar, unlike the other three, is only applicable to a subset of ASP.NET applications that fit in well with the Dynamic Data approach to applications: applications, which are primarily data-centric,  intranet-based applications. That said I could see many places where I might use Dynamic Data, though I am still trying to work through the security implications of opening up the database for pretty much unrestricted reading and writing of database tables.

 (For those who would like to see an MVC version of Dynamic Data: I’d expect to see such a beast come down the pike at some point from Microsoft.)

Conclusion
So what does this mean to the developer? I have both good and bad news.

The good news is that you now have a choice in how you develop your ASP.NET applications. If you love the responsiveness and coolness of AJAX or you need to scale your applications big-time, then you’ll love ASP.NET AJAX.  If, OTOH, you are into unit tests or TDD, you will love ASP.NET MVC. Finally, if you were looking for an easier way to build you basic CRUD web application, you’ll want to take a look at Dynamic Data. Don’t need any of the above? There’s no need to despair--ASP.NET Web Forms are here for the long haul!

The bad news is that you now have a choice in how you develop your ASP.NET applications. (Wait a second, wasn’t that also the good news?)This means you have more things to learn. It also means that in trying to support all four pillars, Microsoft may be taking some of its focus off Web Forms. After all, there’s only so many PMs and devs at Microsoft on the ASP.NET team. Furthermore, this means that if you are a manager like me worried about maintainability of applications and hiring developers, your job just got more difficult because one person’s idea of ASP.NET development is not necessarily someone else’s. Still, I think the good news here, outweighs the bad.

Microsoft used to present ASP.NET Web Forms vs. MVC as a choice between a car and a motorcycle. Both will get you to your job , but some (the majority of the population, I might add) prefer driving a car, while a sizable minority love their motorcycles which give you better gas mileage and independence, but don’t protect you in the rain. To stretch this analogy to its breaking point, let me suggest that ASP.NET AJAX is like riding a bicycle to work (lean and mean, best gas mileage, but it requires you to exercise for your commute and exposes you to the elements like the motorcycle) while Dynamic Data is like taking the bus to work (let metro do the driving for you.)

What about Silverlight?
Silverlight is really just the next generation of a one-click desktop application, that is hosted in the browser and runs on a multi-platform .NET virtual machine. Not to take anything away from Silverlight, but it’s not ASP.NET.

Does this mean that ASP.NET Web Forms is going away?
Although some people “in the know” have stated in the past couple of years that either ASP.NET AJAX or ASP.NET MVC was the future of ASP.NET, this is not the official position of Microsoft. Think about it, since 98%--yes, this is a total educated guess--of ASP.NET development is still done using ASP.NET Web Forms, and this percentage is unlikely to change significantly over the next several years, Microsoft would be stupid to kill off Web Forms. It doesn’t make any economic sense, and since Microsoft is a for-profit entity, I think Web Forms will be a major thrust of ASP.NET for many years to come.

In my opinion, Microsoft has added the three new pillars for the following reasons:

·         Microsoft is always trying to follow innovation and buzz in the industry. Three years ago, that buzz was in AJAX. Today, MVC, separation of concerns, and TDD is all the rage so Microsoft has countered with ASP.NET MVC.

·         Microsoft is always trying to broaden the appeal of ASP.NET. Microsoft has been trying to woo the open source community for years (after initially discounting it). And in order to do this, it needs to embrace many of the ideals of this community, which tends to live on the bleeding edge and is into AJAX, testability, and TDD, amongst other things.

·         Microsoft truly wants to improve the productivity of its customers. After all, if you improve the ability of your customers, in our case corporate and independent developers, to get their jobs done, you’ve gone a long way to attracting and retaining customers. In Microsoft’s eyes (and many of its customers), this is a win, win situation.

 I, for one, would like to thank Microsoft for the four pillars of ASP.NET. In producing the four pillars, Microsoft has given ASP.NET developers the choices they both want and need.

19 Comments

  • Overall, I believe that MS could take Web Forms one step further by adding AJAX capabilities into core controls such as Button and TextBox. You're totally right about the future of Web Forms (even though I believe that a significant share of new apps will be developed over MVC), but it makes me feel sick at the idea of having JS or partial rendering as the only way of getting some AJAX. See Gaia Ajax--that would be a much better Web Forms with AJAX inside.

  • Just last sunday one of my talent friends explained me-"See the ASP.NET MVC tab in http://asp.net site? Yeah, this is the sign what Microsoft wants from MVC. Show me where is your ASP.NET tab in the asp.net site."

    I was really stunned 3 days ago, and today I have come to your article-a good and knowledge-base one!

    Just 2 or 3 minutes ago, I saw someone in the twitter say "started learning ASP.NET MVC". I called my asp.net [strictly form-based, with little javascript/jquery/AJAX, and exactly like me] developer friend next to my desk and asked-"What about ASP.NET MVC?" He just opened his eyes little and smiled!

    But I have got it! I would soon fall into love with the ASP.NET MVC. However, it is not long ago and I have already noted asp.net mvc related posts in asp.net forum. All those posts and other blog posts over the Internet has ignited my mind. Only thing is how could I spare time to get with ASP.NET MVC from my busy development schedule? Could you make your next article titled "Best Ways to Learn ASP.NET MVC from ground"?

    Thanks a lot!

  • I don't think the usage of the phrase "4 pillars" is correct. A pillar is something that goes in conjunction with something else, all being equally important. This is analogous to the pillars of a building holding up the roof. Knock over one pillar, and the roof topples. Typically the usage of the phrase goes along with the basic tenets of a concept, except when they use the term pillar instead of tenet, they mean to imply they are all equally important. In this case you're not describing tenets nor pillars. Sorry.

  • I have to disagree. Silverlight is ASP.NET and over the years will be used more and more as the complete solution. It's great for intranet apps where we would have used Microsoft Access.

    I say it is ASP.NET because it is delivered over the web. If it was just for the desktop it would be WPF.

  • I think the choice of using WebForms or MVC is pretty simple. If you are a web developer who lives and breaths CSS, Javascript, HTML use MVC. If you want to get something done quick and easy (to a point) use WebForms. I also think people shouldn't assume that development in WebForms will be quicker than MVC because of the drag'n'drop even driven model, I find the opposite. A good web developer can churn out CSS and Javascript pretty quickly.

  • I'm not sure I'd consider Dynamic Data a "pillar" of ASP.NET. That would imply that it is a truly parallel option to either WebForms or MVC. The scaffolding behavior is just an implementation detail that is still using WebForms. It isn't a seperate development option. Dynamic Data can be used within existing WebForms applications as well.

  • nice article..

  • [Doug Bennett ]: Well, in the end, all analogies break down. Regardless, I think pillars works for the most part. It's certainly better than the four "tentacles" of ASP.NET. :)

    [adefwebserver] and [Steve Taylor]: No matter how you cut it, All of the pillars I discuss fundamentally work with with the ASP.NET process running on IIS. Silverlight does not and thus is a totally different beast. Can it be used to solve some of the same problems? Sure. But so can PHP or Microsoft Access, for that matter. That's not the point. Nor is the fact that it is launched through the browser: so are one-click apps and Java applets.

  • Thanks, a really good read!

  • Make sense that currently ~98% are under Web Forms pillar. As a result huge software assets and skill sets are already developed in this territory since 2002. The reasonable expectation for those in this territory is to be able to develop new / upgrade existing apps even easier and with better performance/scalability than now. How to achieve that? Keep eye on the ball. If the problems with Web Forms are bulky “data exchange between server and browser” and “incessant ViewState”, then why not focusing on fixing just that? There are solutions that do just that for existing and new applications (we also have one) and 4.0 will bring some additional enhancement to Web Forms. ASP.NET AJAX with update panel is a good evolutionary approach to the existing Web Forms apps. ASP.NET MVC and AJAX with web services IMO should appeal more to those with lesser commitment to maintaining existing apps/codebase and use existing skill sets, as well as “transplants from Ruby, Java”, etc.

  • I think "Get to Know ASP.NET's Four Personalities" might be a better title, or "Core technologies". Pillar is reserved for well founded doctrine. I was expecting some preaching going on when I clicked the link. You know, some ASP.NET commandments.

  • ASP.NET AJAX should be chopped down and replaced with JQuery AJAX. JQuerry just gets it. You call a web service ( Web Forms ) or call a Controller/Action (MVC). When you get the result you change the DOM. A simlar pattern to what the origonal published AJAX is. With ASP.NET AJAX you have to work with pannels events and have little control what is getting sent back and forth across the wire.

  • I invested so much energy, time and passion on Web Forms, that my first reaction was against MVC, even if it made (logically) more sense

  • Good post, well apart from there being 5 pillars, not four (Core / Runtime being the fifth).
    Oh, and DD is not a pillar, ASP.NET Data is...DD is a part of that story.
    I find the discussions on WebForms really interesting, we're having similar ones within the team. We understand that there's a few different audiences for ASP.NET and WebForms serves a hugely important need for part of that audience. We'll continue to add to and improve webforms for the forseeable future, but, well it's already a pretty mature technology.
    The recent focus on MVC is not an indicator that we're abandoning anything, but rather that we're trying to appeal to a part of the developer audience that we didn't really before. It will require more resources for the time being, but that's really to be expected!

  • Nice post Paul....well stated.

  • Scott, seriously I don't think MS has to run after every trend that makes an appearance. Webforms is a pretty solid platform and I don't know why too many people would want to work on MVC instead and spend a lot of time learning and developing.

    I've used MS Ajax in my projects and it seems like a half-hearted effort. The updatepanel created more problems for me then it solved. Now I am using JQuery with ASP.Net Ajax and I like how this works.

    I would have MS continue focusing on the 'real' ASP.Net instead of creating so many flavours of it.

    That said, I need to work on MVC before I can commit to this :)

  • nice article.

  • DevConnections link is not correct.

  • Thanks, a really good post

Comments have been disabled for this content.