<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ASP.NET Is a Leaky Abstraction</title>
	<atom:link href="http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/feed" rel="self" type="application/rss+xml" />
	<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction</link>
	<description>A blog on web standards, accessibility, css, javascript, xslt, and more</description>
	<lastBuildDate>Mon, 09 Jan 2012 03:47:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Anup Shah</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14893</link>
		<dc:creator>Anup Shah</dc:creator>
		<pubDate>Wed, 29 Jun 2011 20:36:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14893</guid>
		<description>Hi Neil, no of course not :)

Maybe more specifically Microsoft&#039;s Update Panel mechanism for AJAX may be something to avoid from time to time as it posts back everything and in some cases (as they have noted) it can be slower than a normal post back. It is certainly a nice idea, to make developers not worry about the JavaScript plumbing needed for it, but that is perhaps another example of an abstraction that leaks (kind of).

As I said in the article, if you are aware of the various issues then you are better prepared to use them if needed - its all appropriate trade-offs at the end of the day - there are times when we&#039;ve opted to use Update Panels in certain circumstances for our back office app where pragmatic (the cost of refactoring/rewriting the controls that take part in the Update Panel was too high, for example).

Since writing the above (a long time ago now), MS have of course embraced jQuery which has a lot of ajax capabilities which you can control more, too.</description>
		<content:encoded><![CDATA[<p>Hi Neil, no of course not <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Maybe more specifically Microsoft&#8217;s Update Panel mechanism for AJAX may be something to avoid from time to time as it posts back everything and in some cases (as they have noted) it can be slower than a normal post back. It is certainly a nice idea, to make developers not worry about the JavaScript plumbing needed for it, but that is perhaps another example of an abstraction that leaks (kind of).</p>
<p>As I said in the article, if you are aware of the various issues then you are better prepared to use them if needed &#8211; its all appropriate trade-offs at the end of the day &#8211; there are times when we&#8217;ve opted to use Update Panels in certain circumstances for our back office app where pragmatic (the cost of refactoring/rewriting the controls that take part in the Update Panel was too high, for example).</p>
<p>Since writing the above (a long time ago now), MS have of course embraced jQuery which has a lot of ajax capabilities which you can control more, too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14891</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Mon, 20 Jun 2011 11:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14891</guid>
		<description>So do you recommend avoiding all uses of AJAX too? I would find that a hard call to make with any technology let alone ASP.NET WebForms.</description>
		<content:encoded><![CDATA[<p>So do you recommend avoiding all uses of AJAX too? I would find that a hard call to make with any technology let alone ASP.NET WebForms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anup Shah</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14890</link>
		<dc:creator>Anup Shah</dc:creator>
		<pubDate>Mon, 20 Jun 2011 10:08:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14890</guid>
		<description>Hi Neil,

The Joel Spolsky quote I used had an example (link buttons that require javascript to post back when clicking a link and don&#039;t work with JS turned off).</description>
		<content:encoded><![CDATA[<p>Hi Neil,</p>
<p>The Joel Spolsky quote I used had an example (link buttons that require javascript to post back when clicking a link and don&#8217;t work with JS turned off).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14888</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Wed, 15 Jun 2011 22:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14888</guid>
		<description>Do you have an example of a leak using ASP.NET WebForms? The post was kinda hand wavy in that department.</description>
		<content:encoded><![CDATA[<p>Do you have an example of a leak using ASP.NET WebForms? The post was kinda hand wavy in that department.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anup Shah</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14884</link>
		<dc:creator>Anup Shah</dc:creator>
		<pubDate>Sun, 12 Jun 2011 13:11:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14884</guid>
		<description>Jon, some interesting comments there. Few thoughts:

The article was specifically about the frustrations that ASP.NET Web Forms has for web developers who want a lot of control over the markup produced. Of course, HTML/JavaScript/CSS are themselves abstractions (with their own leaks!). Everything on top of 1&#039;s and 0&#039;s are an abstraction, so I am not saying that leaky abstractions are bad per se.

My specific gripe at the time was about control of markup being difficult with ASP.NET Web Forms. Especially where client side performance, accessibility, progressive design type of concerns have long put off many web developers and designers from working with ASP.NET, which is a shame as much of the .NET platform is quite powerful.

Since writing the above article (about 3.5 years ago) ASP.NET MVC has come out. In my opinion, their MVC implementation is really good and from what I can understand of the various reasons MS came out with it, one of them included the ability to provide web developers better markup control (as well as improving testability, and so on). That alone tells me they recognized that the markup control was a particular issue they wanted to address.

(ASP.NET MVC had just started to come out when I wrote the above article so didn&#039;t mention it as much as I hadn&#039;t really looked at it then though some others did in the comments). Since then, I&#039;d be really willing to consider MVC over the above-suggested XSLT approach which has worked well in some scenarios.)

Nikhil Kothari&#039;s comment above also hints that for the time ASP.NET was created it was probably what their target audience needed, which is fair enough. But just a few short years after it was out, the landscape had already changed; a lot of developers wanted more markup control and it isn&#039;t easy in an ASP.NET Web Forms world (certainly not impossible as I also note).

ASP.NET MVC certainly feels like it has addressed this particular problem. I should probably update the title of this page now to say ASP.NET *Web Forms* is a Leaky Abstraction, anyway :)</description>
		<content:encoded><![CDATA[<p>Jon, some interesting comments there. Few thoughts:</p>
<p>The article was specifically about the frustrations that ASP.NET Web Forms has for web developers who want a lot of control over the markup produced. Of course, HTML/JavaScript/CSS are themselves abstractions (with their own leaks!). Everything on top of 1&#8242;s and 0&#8242;s are an abstraction, so I am not saying that leaky abstractions are bad per se.</p>
<p>My specific gripe at the time was about control of markup being difficult with ASP.NET Web Forms. Especially where client side performance, accessibility, progressive design type of concerns have long put off many web developers and designers from working with ASP.NET, which is a shame as much of the .NET platform is quite powerful.</p>
<p>Since writing the above article (about 3.5 years ago) ASP.NET MVC has come out. In my opinion, their MVC implementation is really good and from what I can understand of the various reasons MS came out with it, one of them included the ability to provide web developers better markup control (as well as improving testability, and so on). That alone tells me they recognized that the markup control was a particular issue they wanted to address.</p>
<p>(ASP.NET MVC had just started to come out when I wrote the above article so didn&#8217;t mention it as much as I hadn&#8217;t really looked at it then though some others did in the comments). Since then, I&#8217;d be really willing to consider MVC over the above-suggested XSLT approach which has worked well in some scenarios.)</p>
<p>Nikhil Kothari&#8217;s comment above also hints that for the time ASP.NET was created it was probably what their target audience needed, which is fair enough. But just a few short years after it was out, the landscape had already changed; a lot of developers wanted more markup control and it isn&#8217;t easy in an ASP.NET Web Forms world (certainly not impossible as I also note).</p>
<p>ASP.NET MVC certainly feels like it has addressed this particular problem. I should probably update the title of this page now to say ASP.NET *Web Forms* is a Leaky Abstraction, anyway <img src='http://www.onenaught.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Clawley</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14883</link>
		<dc:creator>Jon Clawley</dc:creator>
		<pubDate>Sat, 11 Jun 2011 10:27:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14883</guid>
		<description>To put it another way: I don&#039;t think that the leakiness of the ASP.NET abstraction was a &quot;trap&quot; that the developers fell into. Rather, this leakiness is an essential aspect of the ASP.NET project.</description>
		<content:encoded><![CDATA[<p>To put it another way: I don&#8217;t think that the leakiness of the ASP.NET abstraction was a &#8220;trap&#8221; that the developers fell into. Rather, this leakiness is an essential aspect of the ASP.NET project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Clawley</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14882</link>
		<dc:creator>Jon Clawley</dc:creator>
		<pubDate>Sat, 11 Jun 2011 09:54:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14882</guid>
		<description>Very interesting article, but I have some big questions around some of the &quot;headlines&quot;!

Joel does go on to say that you are pretty much guaranteed leaking in any reasonably complex abstraction, so I think its wrong to present it as a solvable problem. Or as something uniquely bad in ASP.NET...

If an abstraction of web page development were to be entirely non-leaky it would not be an abstraction at all, it would in fact be a translation.

Lets be quite clear, abstraction (even in its inevitable leaky form) is a VERY good thing. Without it we would all have to know everything about the lowest level details of every task we undertake and productivity would literally seize up.

The story of software development is the story of increasing abstraction. Its unwise to try and stand in the way of this march of progress! ;&gt;)

We just do not have the capability or capacity (or the inclination) to train the numbers of people required to learn the non-abstracted version of web development.

Now we come to the more subtle point that every abstraction of a domain will leak in different ways.

Maybe you just don&#039;t like the ways that the ASP.NET abstraction leaks?

Or maybe you are a die-hard purist and can live without any abstraction of web development at all - well, that too is fine but what about the rest of us mortals?!

I think its actually quite an &quot;elite&quot; view to give the impression that the millions of useful/interesting/valuable web pages produced by this ASP.NET abstraction are somehow not of any worth?

And if you don&#039;t think they are worthless (don&#039;t want to put words in your mouth!), then you surely have to give some credit to the &quot;leaky abstraction&quot; of ASP.NET that allowed people to produce them?

Let me put it another way, not every machine that people use to perform useful/valuable/enriching work or leisure has to be an example of the finest engineering.

Its like saying we must all be driving around in highly engineered Ferraris, when for most of us we can get what we want from a car with a Nissan.

I think there is a certain purist attitude (which I can understand) that is offended by these &quot;awful Nissans&quot; filling up the pages of the web with their poor underlying engineering.

But the truth is if they do the job they are intended for then that is my definition of perfect engineering.

All-in-all a great article though and very thought provoking!</description>
		<content:encoded><![CDATA[<p>Very interesting article, but I have some big questions around some of the &#8220;headlines&#8221;!</p>
<p>Joel does go on to say that you are pretty much guaranteed leaking in any reasonably complex abstraction, so I think its wrong to present it as a solvable problem. Or as something uniquely bad in ASP.NET&#8230;</p>
<p>If an abstraction of web page development were to be entirely non-leaky it would not be an abstraction at all, it would in fact be a translation.</p>
<p>Lets be quite clear, abstraction (even in its inevitable leaky form) is a VERY good thing. Without it we would all have to know everything about the lowest level details of every task we undertake and productivity would literally seize up.</p>
<p>The story of software development is the story of increasing abstraction. Its unwise to try and stand in the way of this march of progress! ;&gt;)</p>
<p>We just do not have the capability or capacity (or the inclination) to train the numbers of people required to learn the non-abstracted version of web development.</p>
<p>Now we come to the more subtle point that every abstraction of a domain will leak in different ways.</p>
<p>Maybe you just don&#8217;t like the ways that the ASP.NET abstraction leaks?</p>
<p>Or maybe you are a die-hard purist and can live without any abstraction of web development at all &#8211; well, that too is fine but what about the rest of us mortals?!</p>
<p>I think its actually quite an &#8220;elite&#8221; view to give the impression that the millions of useful/interesting/valuable web pages produced by this ASP.NET abstraction are somehow not of any worth?</p>
<p>And if you don&#8217;t think they are worthless (don&#8217;t want to put words in your mouth!), then you surely have to give some credit to the &#8220;leaky abstraction&#8221; of ASP.NET that allowed people to produce them?</p>
<p>Let me put it another way, not every machine that people use to perform useful/valuable/enriching work or leisure has to be an example of the finest engineering.</p>
<p>Its like saying we must all be driving around in highly engineered Ferraris, when for most of us we can get what we want from a car with a Nissan.</p>
<p>I think there is a certain purist attitude (which I can understand) that is offended by these &#8220;awful Nissans&#8221; filling up the pages of the web with their poor underlying engineering.</p>
<p>But the truth is if they do the job they are intended for then that is my definition of perfect engineering.</p>
<p>All-in-all a great article though and very thought provoking!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slevdi</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14044</link>
		<dc:creator>Slevdi</dc:creator>
		<pubDate>Wed, 09 Dec 2009 23:06:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14044</guid>
		<description>You quote Joel Spolsky alot. You should point out that his flagship product - Fogbugz - still uses Classic ASP 8 years laters!</description>
		<content:encoded><![CDATA[<p>You quote Joel Spolsky alot. You should point out that his flagship product &#8211; Fogbugz &#8211; still uses Classic ASP 8 years laters!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Foray into ASP.NET MVC &#171; nicholascloud.com</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-14015</link>
		<dc:creator>Foray into ASP.NET MVC &#171; nicholascloud.com</dc:creator>
		<pubDate>Sat, 31 Oct 2009 21:22:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-14015</guid>
		<description>[...] my hope in a Microsoft web product.  I am among the snobs who think ASP.NET WebForms is a terrible leaky abstraction.  MVC changes all that by assuming that web standards and semantically meaningful markup are not [...]</description>
		<content:encoded><![CDATA[<p>[...] my hope in a Microsoft web product.  I am among the snobs who think ASP.NET WebForms is a terrible leaky abstraction.  MVC changes all that by assuming that web standards and semantically meaningful markup are not [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiang</title>
		<link>http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction/comment-page-1#comment-13785</link>
		<dc:creator>jiang</dc:creator>
		<pubDate>Fri, 02 Jan 2009 03:45:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.onenaught.com/posts/42/aspnet-is-a-leaky-abstraction#comment-13785</guid>
		<description>great comments from Michael C. Neel I thought I would like to share:

http://devlicio.us/blogs/vinull/archive/2008/07/25/the-mvc-minefield.aspx

The MVC Minefield

There is a bit of turbulence in the ASP.NET airspace over MVC (yes, I&#039;m making this post while on the fight back from the ASPInsiders Summit).  Even among the ASPInsiders, who are supposed to be at the cutting edge of ASP.NET, there is little agreement over what is MVC and what it&#039;s for.

MVC, or Model View Controller, is an age old pattern found in many places.  ASP.NET providers follow the pattern, as does Service Oriented Architecture.  The general idea to have some code called a Model that works with your data storage, other code called a View that displays the data, and last plumbing code that ties these two together, called the Controller.  I call it a pattern because implementations differ in the details - the View may render a button, but when the user clicks that button should the click action be handled by the View or Controller?  The Model and View should know nothing of each other, but is the Controller allowed to be tightly coupled to them both?  (If your first thought above was the Controller should handle the button action, think now what this means about being loosely coupled between the View and Controller).

ASP.NET MVC is a framework in development that is intended to closely match the MVC pattern.  The minefield lies in answering the pragmatic question of what does ASP.NET MVC offer over WebForms, and when would you use MVC?  In taking with those excited by MVC the reasons range from supporting TDD, clean URLs and avoiding postbacks by sending actions to a controller, better control over HTML output (including getting rid of ViewState), and being closer to the http protocol.

TDD, or Test Driven Development, will always come up in any ASP.NET MVC conversation, but TDD itself isn&#039;t an explicit part of MVC.  The MVC pattern is very amendable to TDD however, and thus the association.  I generally support testable code even if there are no tests around the code.  Testable code is much easier to maintain, enhance, refractor, and replace.  I don&#039;t find the process of test-first development helpful, but I do write tests in the same session as the code when I know I&#039;m writing some critical piece of functionality that needs to survive multiple versions of the software.  As Hanselman noted, I&#039;m like the &quot;person who goes to church on Easter and Christmas&quot; and I&#039;m sometimes looked down upon by the congregation who attend weekly.  I&#039;m okay with this, but I have some reservations with MVC as a framework for TDD.

To say you cannot test WebForms is a strawman argument; there is no trouble in separating the Model and testing it thoroughly.  Depending on how you go about it, you can also separate the Controllers and test them - I generally have very simple Controllers that pass user input into the Model as is, so testing the Controller is not that important to me.  Testing the View in WebForms is very difficult - and this isn&#039;t specific to WebForms.  My objection to claiming MVC has testable Views is the implied definition of testing.  Verifying the output HTML of a View is not helpful at all - it&#039;s just string comparison.   I want to write tests like Asset.JavascriptRunsOnSafariMac() and Assert.IE8RendersSameAsFireFox3().  If MVC could do that, then I would be switching to it today!

WebForms provides a very robust SiteMapProvider interface that makes it easy to clean up urls of dynamic content.  Global.asax can be using to control routing of requests (in fact this is how MVC does it as well).  The biggest problem I&#039;ve had here isn&#039;t WebForms fault, but IIS6&#039;s inability to allow ASP.NET to handle requests without an ASP.NET extension in them: this is solved in IIS7.

You can get fine grain control of HTML in WebForms, ever with just the stock controls.  There is also an entire collection of HTML server controls to match HTML tags to make it easy to generate HTML from code (I hate seeing tags hardcoded in source file, feels dirty and hackish).  About the one thing that is hard to do in WebForms I deal with somewhat often is controlling the client side ID&#039;s, which can become quite long and fugly looking.  For CSS you can just assign a class name instead of using ID references (and there aren&#039;t many places I&#039;m using CSS IDs except for layout divs that aren&#039;t coming from ASP.NET controls anyway).  Javascript is trickier; you need to inject a reference of Control.ClientID on the server in the client script, and the need is much more common than with CSS.  If you have an external JavaScript file this can get worse, but I believe that an external JS method should take the ID of the control they work with as a parameter making it easier to read the external file without the need to reference the aspx code.  At the end of the day however, I&#039;m not willing to throw the &quot;baby out with the bath water&quot; and will lean more on Microsoft to fix this issue in WebForms rather than jump to MVC.

The last reason for MVC I mentioned, being closer to the http protocol and its stateless nature, I simply don&#039;t grok.  Any application with a basic level of user interaction will need to mask the http protocol&#039;s implementation details to provide a positive user experience.  Web programmers of all frameworks and languages have realized there are only a few methods to solve this problem; cookies, url parameters, and hidden fields.  Any state solution will involve one or all of these - even if state is stored on the server&#039;s side.  WebForms supports all of these methods, and you can disable things like ViewState (hidden fields) if desired.  (I am aware there is also ControlState that will be still emitted if ViewState is disabled, but I&#039;m willing to say that if these few bytes are an impact you are working on an edge case).

I&#039;m not here to bash ASP.NET MVC - to the contrary I&#039;m here to help by outlining the faults in the current arguments for MVC.  If MVC is defined by the features in or not in WebForms, then it&#039;s going to be hard for those deep into WebForms to see value in MVC.  It becomes a song of &quot;anything you can do, I can do better (no you can&#039;t, yes I can)&quot; and will deadlock when neither side is listening to the other.  ASP.NET MVC need to be defined without claiming faults in WebForms, because that only says use MVC because WebForms is broken - leading one to say, &quot;why not just fix WebForms?&quot;

I wish I could end here with a new explanation of ASP.MVC meeting the requirements I&#039;ve just stated, but I&#039;m afraid I can&#039;t.  This is a fault with me, and not the MVC framework - I&#039;m too close and deep into WebForms to see a need for MVC I can&#039;t fill already.  It&#039;s my hope and request that instead of seeking to pick apart this post, the supporters of MVC come out to define MVC without attaching that definition to the perceived faults (for that&#039;s the minefield) of WebForms.</description>
		<content:encoded><![CDATA[<p>great comments from Michael C. Neel I thought I would like to share:</p>
<p><a href="http://devlicio.us/blogs/vinull/archive/2008/07/25/the-mvc-minefield.aspx" rel="nofollow">http://devlicio.us/blogs/vinull/archive/2008/07/25/the-mvc-minefield.aspx</a></p>
<p>The MVC Minefield</p>
<p>There is a bit of turbulence in the ASP.NET airspace over MVC (yes, I&#8217;m making this post while on the fight back from the ASPInsiders Summit).  Even among the ASPInsiders, who are supposed to be at the cutting edge of ASP.NET, there is little agreement over what is MVC and what it&#8217;s for.</p>
<p>MVC, or Model View Controller, is an age old pattern found in many places.  ASP.NET providers follow the pattern, as does Service Oriented Architecture.  The general idea to have some code called a Model that works with your data storage, other code called a View that displays the data, and last plumbing code that ties these two together, called the Controller.  I call it a pattern because implementations differ in the details &#8211; the View may render a button, but when the user clicks that button should the click action be handled by the View or Controller?  The Model and View should know nothing of each other, but is the Controller allowed to be tightly coupled to them both?  (If your first thought above was the Controller should handle the button action, think now what this means about being loosely coupled between the View and Controller).</p>
<p>ASP.NET MVC is a framework in development that is intended to closely match the MVC pattern.  The minefield lies in answering the pragmatic question of what does ASP.NET MVC offer over WebForms, and when would you use MVC?  In taking with those excited by MVC the reasons range from supporting TDD, clean URLs and avoiding postbacks by sending actions to a controller, better control over HTML output (including getting rid of ViewState), and being closer to the http protocol.</p>
<p>TDD, or Test Driven Development, will always come up in any ASP.NET MVC conversation, but TDD itself isn&#8217;t an explicit part of MVC.  The MVC pattern is very amendable to TDD however, and thus the association.  I generally support testable code even if there are no tests around the code.  Testable code is much easier to maintain, enhance, refractor, and replace.  I don&#8217;t find the process of test-first development helpful, but I do write tests in the same session as the code when I know I&#8217;m writing some critical piece of functionality that needs to survive multiple versions of the software.  As Hanselman noted, I&#8217;m like the &#8220;person who goes to church on Easter and Christmas&#8221; and I&#8217;m sometimes looked down upon by the congregation who attend weekly.  I&#8217;m okay with this, but I have some reservations with MVC as a framework for TDD.</p>
<p>To say you cannot test WebForms is a strawman argument; there is no trouble in separating the Model and testing it thoroughly.  Depending on how you go about it, you can also separate the Controllers and test them &#8211; I generally have very simple Controllers that pass user input into the Model as is, so testing the Controller is not that important to me.  Testing the View in WebForms is very difficult &#8211; and this isn&#8217;t specific to WebForms.  My objection to claiming MVC has testable Views is the implied definition of testing.  Verifying the output HTML of a View is not helpful at all &#8211; it&#8217;s just string comparison.   I want to write tests like Asset.JavascriptRunsOnSafariMac() and Assert.IE8RendersSameAsFireFox3().  If MVC could do that, then I would be switching to it today!</p>
<p>WebForms provides a very robust SiteMapProvider interface that makes it easy to clean up urls of dynamic content.  Global.asax can be using to control routing of requests (in fact this is how MVC does it as well).  The biggest problem I&#8217;ve had here isn&#8217;t WebForms fault, but IIS6&#8242;s inability to allow ASP.NET to handle requests without an ASP.NET extension in them: this is solved in IIS7.</p>
<p>You can get fine grain control of HTML in WebForms, ever with just the stock controls.  There is also an entire collection of HTML server controls to match HTML tags to make it easy to generate HTML from code (I hate seeing tags hardcoded in source file, feels dirty and hackish).  About the one thing that is hard to do in WebForms I deal with somewhat often is controlling the client side ID&#8217;s, which can become quite long and fugly looking.  For CSS you can just assign a class name instead of using ID references (and there aren&#8217;t many places I&#8217;m using CSS IDs except for layout divs that aren&#8217;t coming from ASP.NET controls anyway).  Javascript is trickier; you need to inject a reference of Control.ClientID on the server in the client script, and the need is much more common than with CSS.  If you have an external JavaScript file this can get worse, but I believe that an external JS method should take the ID of the control they work with as a parameter making it easier to read the external file without the need to reference the aspx code.  At the end of the day however, I&#8217;m not willing to throw the &#8220;baby out with the bath water&#8221; and will lean more on Microsoft to fix this issue in WebForms rather than jump to MVC.</p>
<p>The last reason for MVC I mentioned, being closer to the http protocol and its stateless nature, I simply don&#8217;t grok.  Any application with a basic level of user interaction will need to mask the http protocol&#8217;s implementation details to provide a positive user experience.  Web programmers of all frameworks and languages have realized there are only a few methods to solve this problem; cookies, url parameters, and hidden fields.  Any state solution will involve one or all of these &#8211; even if state is stored on the server&#8217;s side.  WebForms supports all of these methods, and you can disable things like ViewState (hidden fields) if desired.  (I am aware there is also ControlState that will be still emitted if ViewState is disabled, but I&#8217;m willing to say that if these few bytes are an impact you are working on an edge case).</p>
<p>I&#8217;m not here to bash ASP.NET MVC &#8211; to the contrary I&#8217;m here to help by outlining the faults in the current arguments for MVC.  If MVC is defined by the features in or not in WebForms, then it&#8217;s going to be hard for those deep into WebForms to see value in MVC.  It becomes a song of &#8220;anything you can do, I can do better (no you can&#8217;t, yes I can)&#8221; and will deadlock when neither side is listening to the other.  ASP.NET MVC need to be defined without claiming faults in WebForms, because that only says use MVC because WebForms is broken &#8211; leading one to say, &#8220;why not just fix WebForms?&#8221;</p>
<p>I wish I could end here with a new explanation of ASP.MVC meeting the requirements I&#8217;ve just stated, but I&#8217;m afraid I can&#8217;t.  This is a fault with me, and not the MVC framework &#8211; I&#8217;m too close and deep into WebForms to see a need for MVC I can&#8217;t fill already.  It&#8217;s my hope and request that instead of seeking to pick apart this post, the supporters of MVC come out to define MVC without attaching that definition to the perceived faults (for that&#8217;s the minefield) of WebForms.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

