<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://experience.fellowshipone.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Intelligent Design : .NET</title><link>http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/.NET/default.aspx</link><description>Tags &amp; Topics: .NET</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61120.2)</generator><item><title>A Little Christmas Coding Magic</title><link>http://experience.fellowshipone.com/blogs/intelligentdesign/archive/2007/12/13/A-Little-Christmas-Coding-Magic.aspx</link><pubDate>Thu, 13 Dec 2007 07:01:00 GMT</pubDate><guid isPermaLink="false">87eee960-b871-44cb-8a98-02588a960c04:9226</guid><dc:creator>FTProductDev</dc:creator><slash:comments>1</slash:comments><comments>http://experience.fellowshipone.com/blogs/intelligentdesign/comments/9226.aspx</comments><wfw:commentRss>http://experience.fellowshipone.com/blogs/intelligentdesign/commentrss.aspx?PostID=9226</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;When I was a kid I loved magic - simple card tricks to &lt;A class="" href="http://www.dcopperfield.com/" target=_blank&gt;Copperfield’s&lt;/A&gt; million dollar illusions, I was easily mesmerized and mystified.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;People have been bending what we &lt;STRONG&gt;THINK&lt;/STRONG&gt; is reality for years.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Take a look at the picture - Which way does this window face. Are the people on the inside looking to the left or looking to the right? Are you looking up into the window, or are you looking down into the window?&lt;IMG title="optical window" style="WIDTH:220px;HEIGHT:300px;" height=300 alt="optical window" hspace=10 src="https://experience.fellowshipone.com/images/blogs/nfloyd-assume1.gif" width=220 align=right&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Same thing goes for programming – what we type out in code does not always translate to "what is" during execution; especially if you’re dealing with a compiler between what you write and&amp;nbsp;assembled code delivered into production.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;Take the battle between a couple of conditional processing structures provided in C# (and most other languages): Who’s “better” regarding efficiency and elegance - a switch (case) statement or If-Else conditional statement.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;The &lt;A class="" title=GoOracle href="http://www.google.com/search?source=ig&amp;amp;hl=en&amp;amp;rlz=&amp;amp;q=switch+vs+if" target=_blank&gt;GoOracle&lt;/A&gt; would tell you this is a &lt;A class="" href="http://www.blackwasp.co.uk/SpeedTestIfElseSwitch.aspx" target=_blank&gt;no brainer&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Calibri size=3&gt;, and logically we would assume that switch would perform better because the framework does not have to evaluate each statement in the flow.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;Let’s assume otherwise and challenge the norm given the following code in pre-compiled form:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;private static void SwitchSingleCondition() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Stopwatch timer = new Stopwatch();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Start(); // Start the timer&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;for (long i = 1; i &amp;lt;= 10000; i++) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;switch (compare) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;case "a":&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;compare = "b";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;break;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;case "b":&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;break;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;default:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;break;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Stop(); // Stop the timer&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine("Execution time for 'Switch Single Condition' was {0:F1} microseconds.", (decimal)timer.Elapsed.Ticks / 10M);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;private static void IfSingleCondition() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Stopwatch timer = new Stopwatch();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Start(); // Start the timer&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;for (long i = 1; i &amp;lt;= 10000; i++) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if (compare == "a") {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "b";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} else if (compare == "b") {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} else {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Stop(); // Stop the timer&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Console.WriteLine("Execution time for 'If Single Condition' was {0:F1} microseconds.", (decimal)timer.Elapsed.Ticks / 10M);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;When executed we get the following results:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG style="WIDTH:400px;HEIGHT:52px;" height=52 src="https://experience.fellowshipone.com/images/blogs/nfloyd-assume2.jpg" width=400&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;Why did the “if statement” run more efficiently than the switch? Let’s pull back the curtain and take away the mirrors – this is what the code looks like after compilation (&lt;A class="" title=Reflector href="http://www.aisto.com/roeder/dotnet/" target=_blank&gt;Reflector&lt;/A&gt;&amp;nbsp;you rock!):&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;private static void SwitchSingleCondition()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Stopwatch timer = new Stopwatch();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Start();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;for (long i = 1L; i &amp;lt;= 0x2710L; i += 1L) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string CS$0$0000 = compare;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if (CS$0$0000 == null) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;goto Label_004B;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if (!(CS$0$0000 == "a")){&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if (CS$0$0000 == "b"){&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;goto Label_0043;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;goto Label_004B;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "b";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;continue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Label_0043:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;continue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Label_004B:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Stop();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;decimal CS$0$0000 = timer.Elapsed.Ticks / 10M;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine("Execution time for 'Switch Single Condition' was {0:F1} microseconds.", CS$0$0000);}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;private static void IfSingleCondition()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Stopwatch timer = new Stopwatch();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Start();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;for (long i = 1L; i &amp;lt;= 0x2710L; i += 1L) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if (compare == "a"){&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "b";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else if (compare == "b"){&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Else {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;compare = "a";&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;timer.Stop();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;decimal CS$0$0000 = timer.Elapsed.Ticks / 10M;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine("Execution time for 'If Single Condition' was {0:F1} microseconds.", CS$0$0000);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;SPAN style="FONT-SIZE:8pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;Are you kidding me – the “if” logic even looks more elegant!&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;So what happened?&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;It seems that behind the smoke, mirrors, and assumptions the .NET framework looks at the code that was written and restructures it to what it thinks will be more efficient using if-else conditions, “goto” statements, and a labeling system.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Once your case statement exceeds 4 conditions the compiler will leave the code alone and execute it as a normal switch case.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;It turns out that if-else-if statements can and most likely will be more efficient than switch statements when the number conditions do not exceed four.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; Things aren't always what they seem. &lt;/SPAN&gt;Don’t be blinded by the magic – challenge your assumptions - until they become &lt;STRONG&gt;fact&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;--nick&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://experience.fellowshipone.com/aggbug.aspx?PostID=9226" width="1" height="1"&gt;</description><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/.NET/default.aspx">.NET</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/development/default.aspx">development</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Code/default.aspx">Code</category></item><item><title>Asp.Net vs. Standards</title><link>http://experience.fellowshipone.com/blogs/intelligentdesign/archive/2007/02/02/Asp.Net-vs.-Standards.aspx</link><pubDate>Fri, 02 Feb 2007 23:29:00 GMT</pubDate><guid isPermaLink="false">87eee960-b871-44cb-8a98-02588a960c04:1028</guid><dc:creator>mvasquez</dc:creator><slash:comments>2</slash:comments><comments>http://experience.fellowshipone.com/blogs/intelligentdesign/comments/1028.aspx</comments><wfw:commentRss>http://experience.fellowshipone.com/blogs/intelligentdesign/commentrss.aspx?PostID=1028</wfw:commentRss><description>&lt;p&gt;A few months back I converted our site template from a table-based layout to a standards based design.&amp;nbsp; This was not a trivial task, in essence I &amp;quot;touched&amp;quot; every page in our app, which is more than 300 pages.&amp;nbsp; Recently we released major pieces of functionality, both using standards based html and heavy client-side functionality (ajax via prototype, effects/drag drop via scriptaculous).&amp;nbsp; For the entirety of the project I was in a constant struggle with &lt;a href="http://asp.net"&gt;asp.net&lt;/a&gt;&amp;nbsp;and it&amp;#39;s blatant disregard for supporting standards based design&amp;nbsp; and&amp;nbsp;HTML standards in general.&amp;nbsp;&amp;nbsp;Listed below are the issues that drove me&amp;nbsp;to the edge of insanity, almost to the point of shunning off asp.net forever.&amp;nbsp; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;INamingContainer&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I understand the need to uniquely identify objects in the control tree.&amp;nbsp; But why does that id have to be persisted to the client?&amp;nbsp; How are you suppose to get a reference to an element in css or javascript if you can&amp;#39;t rely on the id?&amp;nbsp; I&amp;#39;ve got an idea, stop trying to hold my hand and let me be responsible for uniquely identifying my controls.&amp;nbsp; This leads to abusing the class attribute and using it where it simply should not be needed.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;One form per page with runat=&amp;quot;server&amp;quot;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I&amp;#39;ve been told that this has since been addressed in 2.0.&amp;nbsp; In 1.1 this is unacceptable, for instance, in our site template we have a drop down within our sub navigation (don&amp;#39;t ask&amp;nbsp;me why it is in the navigation)&amp;nbsp;that contains all ministries a user has rights to.&amp;nbsp; This drop down should&amp;nbsp;be contained within it&amp;#39;s own form,&amp;nbsp;along with&amp;nbsp;a form&amp;nbsp;containing all&amp;nbsp;controls within the main&amp;nbsp;content section.&amp;nbsp; but because a)&amp;nbsp;System.Web.UI.WebControls.DropDownLists must be contained within a form with runat=&amp;quot;server&amp;quot; and B) only one form with runat=&amp;quot;server&amp;quot; is allowed on the page; I&amp;nbsp;now have to encapsulate the entire sub navigation and content in a single&amp;nbsp;form.&amp;nbsp; There-by sacrificing good design.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Controls render horrendous HTML&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;So I&amp;#39;ve just added a System.Web.UI.WebControls.DataGrid and I&amp;#39;ve set the DisplayHeader to true and HeaderText to &amp;quot;Name&amp;quot;.&amp;nbsp; Ok, let&amp;#39;s see here, we have a grid that should be displayed as a table (check).&amp;nbsp; We have a header for that grid/table, so that should be a table header, th tag, (che....oh wait).&amp;nbsp; Where is the th tag?&amp;nbsp; There are too many of these instances to list each one.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;System.Web.UI.WebControls.Label renders as a span tag&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Did anyone on the asp.net team even look at the HTML &lt;a href="http://www.w3.org/TR/html401/"&gt;specification&lt;/a&gt;?&lt;/p&gt; &lt;p&gt;&lt;strong&gt;No support for OPTGROUP element&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Seriously?&amp;nbsp; I mean, come on, DID ANYONE EVEN LOOK AT THE HTML &lt;a href="http://www.w3.org/TR/html401/"&gt;SPECIFICATION&lt;/a&gt;?&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Quirksmode is default for new aspx pages&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;If you truly support web standards how can you default a document to Quirksmode.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;No easy way to get HTML from a server-side control&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;A significant advantage of ajax is not having to render the entire page, especially if sections of the page may or may not be used.&amp;nbsp; On the server an ajax request is not handled any differently than&amp;nbsp;clicking a button or link.&amp;nbsp; There is a significant advantage in being able to request pieces of HTML from the server and respond with that HTML to be rendered&amp;nbsp;on the client&amp;nbsp;(&lt;a href="http://microformats.org/wiki/rest/ahah"&gt;AHAH&lt;/a&gt;).&amp;nbsp; but because asp.net controls must a) be apart of a form with runat=&amp;quot;server&amp;quot; and b) cannot be rendered before the form is rendered, this is impossible.&amp;nbsp; Besides creating a user control and then loading that control at runtime there is no way to get HTML from an&amp;nbsp;aspx page.&amp;nbsp; Well, no way that I could come up with.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;System.Web.UI.WebControls.DropDownList must be contained within a form with runat=&amp;quot;server&amp;quot;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Why?&amp;nbsp; &lt;/p&gt; &lt;p&gt;Did I miss something?&amp;nbsp; I&amp;#39;m not too terribly familiar with the machine.config or the web.config, maybe I forgot to include &amp;lt;standards-mode enabled=&amp;quot;true&amp;quot; /&amp;gt;?&amp;nbsp;&amp;nbsp;Microsoft&amp;#39;s marketing machine can preach all they want about standards support&amp;nbsp;(why do I still have to use the Holly Hack in IE7, &lt;a href="http://blogs.msdn.com/ie/archive/2006/08/22/712830.aspx"&gt;wasn&amp;#39;t this bug fixed&lt;/a&gt;?&amp;nbsp;), but marketing&amp;nbsp;will&amp;nbsp;only go so far.&amp;nbsp; People will tell me that concessions have to be made in order to support the designer and being able to drag and drop a control from the toolbox.&amp;nbsp; But you know what, I don&amp;#39;t care, if your dragging and dropping controls from the toolbox then you need to find another profession.&amp;nbsp; Creating&amp;nbsp;web applications&amp;nbsp;is not for you.&lt;/p&gt; &lt;p&gt;Does anyone else struggle with these issues?&amp;nbsp; &lt;/p&gt;&lt;img src="http://experience.fellowshipone.com/aggbug.aspx?PostID=1028" width="1" height="1"&gt;</description><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Design/default.aspx">Design</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/markup/default.aspx">markup</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/HTML/default.aspx">HTML</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/CSS/default.aspx">CSS</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/.NET/default.aspx">.NET</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/development/default.aspx">development</category></item><item><title>Typed Navigation</title><link>http://experience.fellowshipone.com/blogs/intelligentdesign/archive/2007/01/09/Typed-Navigation.aspx</link><pubDate>Tue, 09 Jan 2007 17:12:00 GMT</pubDate><guid isPermaLink="false">87eee960-b871-44cb-8a98-02588a960c04:808</guid><dc:creator>thardy</dc:creator><slash:comments>0</slash:comments><comments>http://experience.fellowshipone.com/blogs/intelligentdesign/comments/808.aspx</comments><wfw:commentRss>http://experience.fellowshipone.com/blogs/intelligentdesign/commentrss.aspx?PostID=808</wfw:commentRss><description>&lt;p&gt;One of the features we&amp;#39;ve worked into our new home-grown architecture&amp;nbsp;is typed navigation.&amp;nbsp; Without typed navigation,&amp;nbsp;urls are strewn throughout the code, and any changes to navigation or querystrings involve updates to many pages. &amp;nbsp;Not only that, providing a page the data it needs to properly initialize can be difficult to manage and very easy to misunderstand by a developer who is working in a page they&amp;#39;re not familiar with.&amp;nbsp; These issues cause navigation edits to be error-prone and reduce maintainability and extensibility.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The Need&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Consider the following common scenario - You&amp;#39;ve got a page (let&amp;#39;s say EmployeeDetail.aspx) that requires an EmployeeID be passed to it.&amp;nbsp; There are many different ways to get the ID to the page:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;QueryString - EmployeeDetail.aspx?empID=100&lt;/li&gt;&lt;li&gt;Session - Session[&amp;quot;EmployeeID&amp;quot;] = 100&lt;/li&gt;&lt;li&gt;Database retrieval&lt;/li&gt;&lt;li&gt;etc...&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Each method involves different code to set and retrieve the value.&amp;nbsp; In addition, almost every app uses multiple methods in different places and in different scenarios.&amp;nbsp; This results in too many decisions being made by too many different developers, which results in maintenance nightmares.&amp;nbsp; Strict processes can mitigate some of the maintenance pain,&amp;nbsp;if all of your developers ALWAYS use the exact same mechanism, but what about extensibility?&amp;nbsp; What if the page name needs to change at some point?&amp;nbsp; What if you decide to change the way you handle data transfer between pages?&amp;nbsp; Or, more commonly, what if a page simply changes the data it needs or accepts?&lt;/p&gt;&lt;p&gt;Cascading Style Sheets (CSS) is a good example of an architecture with big benefits in UI design - you can make a style change in one place, and that change gets applied in all pages where that style is used.&amp;nbsp; The same measuring stick can be applied to all architectures - can you make a configuration change in a few places (preferably one), and have it applied in all areas of usage?&amp;nbsp; I think most apps would fail this measure in the area of navigation.&amp;nbsp; If a page name changes, most application architectures would require manual changes in many pages - links, code behind redirects, data tables, etc.&amp;nbsp; Even more architectures would fail the test if a change is made to how data is transferred.&amp;nbsp; If a QueryString value changes from empID, to eID, how many code changes would need to be made?&amp;nbsp; What if a page now requires an orgID?&amp;nbsp; Or how about if you move from QueryString to Session, or vice versa?&amp;nbsp; This is where good architectures shine in the long run.&amp;nbsp; Yes you can continue to change the font&amp;nbsp;manually in all your pages when your app is small, but heavy usage of CSS is now widely accepted as best-practice simply because style maintenance and extensibility become absolutely crazy as the number of pages in your site gets large.&amp;nbsp; Why should navigation be any different?&amp;nbsp; It gets just as crazy as your app gets large, and can benefit just as much&amp;nbsp;from a consolidated architecture.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Our solution is to use typed navigation.&amp;nbsp; There are several potential architectures available, one of which is &lt;a href="http://metasapiens.com/PageMethods/"&gt;PageMethods&lt;/a&gt;.&amp;nbsp; There&amp;#39;s a great list of the benefits of typed navigation on that page, so I&amp;#39;ll try not to rehash all of them here.&amp;nbsp; We took a good look at this&amp;nbsp;solution before developing our own architecture, but decided we wanted much more control over our navigation.&amp;nbsp; Also, the PageMethods solution is locked into generating urls with QueryStrings, and it involves&amp;nbsp;pages calling specific methods in other pages, which our new architecture steers clear of&amp;nbsp;due to MVC principles.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Our architecture includes the following:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Typed Location objects - every navigation destination (View) has its own Location class&lt;/li&gt;&lt;li&gt;Each Location&amp;nbsp;class defines a constant &amp;quot;ViewName&amp;quot; which maps to a url defined in a database, so no urls or page names are ever written in code&amp;nbsp; &lt;/li&gt;&lt;li&gt;Each Location&amp;nbsp;class can have multiple constructors - the constructors provide all the contracts to create&amp;nbsp;the View and allow pages to fulfill multiple roles (list/detail based on what data is sent to them)&lt;/li&gt;&lt;li&gt;Usage in links - a new Location object is created in code-behind and used to set&amp;nbsp;the&amp;nbsp;Location property on one of our HyperLink controls.&amp;nbsp; If set,&amp;nbsp;the HyperLink control has the Location&amp;nbsp;generate its URL when the control is rendered.&amp;nbsp; &lt;/li&gt;&lt;li&gt;Usage in server-side redirects - a controller simply creates a new Location object and calls a&amp;nbsp;public Navigate method on its View &lt;/li&gt;&lt;li&gt;Hydrating Location objects - our base Page class takes care of rehydrating the location object and transferring its data to the View&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Here are the only two options a developer will see regarding Navigation in our app:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;For a HyperLink:&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;font face="courier new,courier"&gt;lnkEmployeeDetail.Location = new EmployeeDetailLocation(employeeID);&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;For a server-side redirect:&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;&lt;font face="courier new,courier"&gt;_myView.Navigate(new EmployeeDetailLocation(employeeID));&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Since all this is handled by the architecture, changes can be made in just a few places and totally change the Navigation mechanism.&amp;nbsp; We can switch from QueryStrings to Session variables, or rewrite URLs, or change how we rewrite URLs as often as we want.&amp;nbsp; No code that actually uses the Navigation would ever need to change, and&amp;nbsp;page names can change without missing a beat.&amp;nbsp;&amp;nbsp;All the code written to create strongly-typed Location objects would continue to navigate as usual.&amp;nbsp;&amp;nbsp;If a page&amp;#39;s initialization requirements changed, then code would break at compile time instead of runtime, with a very clear and self-describing explanation of exactly how the new Location object needs to be constructed.&amp;nbsp; That&amp;#39;s a lot better than having some forgotten link deep in your app with an obsolete parameter definition getting discovered by a customer after you&amp;#39;ve published your app to production.&lt;/p&gt;&lt;p&gt;Typed Navigation is one more step we&amp;#39;re taking to make our code easy to work with and understand, regardless of how long it&amp;#39;s been since anyone&amp;#39;s&amp;nbsp;touched it,&amp;nbsp;how many developers have had their hands in it, or how large it grows.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://experience.fellowshipone.com/aggbug.aspx?PostID=808" width="1" height="1"&gt;</description><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/.NET/default.aspx">.NET</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Navigation/default.aspx">Navigation</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Framework/default.aspx">Framework</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/URL/default.aspx">URL</category></item><item><title>Persistence via Attributes</title><link>http://experience.fellowshipone.com/blogs/intelligentdesign/archive/2006/10/20/Persistence-via-Attributes.aspx</link><pubDate>Fri, 20 Oct 2006 13:12:00 GMT</pubDate><guid isPermaLink="false">87eee960-b871-44cb-8a98-02588a960c04:560</guid><dc:creator>thardy</dc:creator><slash:comments>0</slash:comments><comments>http://experience.fellowshipone.com/blogs/intelligentdesign/comments/560.aspx</comments><wfw:commentRss>http://experience.fellowshipone.com/blogs/intelligentdesign/commentrss.aspx?PostID=560</wfw:commentRss><description>&lt;p&gt;In the new architecture we&amp;#39;ve been developing, one of the features we&amp;#39;ve developed is a common persistence mechanism.&amp;nbsp; Once again, our attempts are to make development as clear and painless as possible.&amp;nbsp; We want to make it incredibly easy to write good code, and difficult to make mistakes.&amp;nbsp; As our development team grows and code authors move on to other things and other devs&amp;nbsp;end up maintaining that code, we want it to be downright difficult to misunderstand or misuse anything.&lt;/p&gt;&lt;p&gt;Persistence is one area that we&amp;#39;ve seen misused in the past.&amp;nbsp; Basically, anyone can put anything in Session or ViewState from almost anywhere they want.&amp;nbsp; Well, they can from the code-behind of pages, which, like I discussed earlier, ends up getting a great deal of logic thrown in there.&amp;nbsp; We decided to put a stop to this in our new architecture.&lt;/p&gt;&lt;p&gt;We&amp;#39;ve refactored all the persistence code into base classes, and we&amp;#39;re using attributes to decorate our View properties like the following:&lt;/p&gt;&lt;p style="font-family:courier;"&gt;[Persist(PersistenceType.Session)]&lt;br /&gt;public int IndividualID {get{} set{}}&lt;/p&gt;&lt;p&gt;This allows us to very simply specify what needs to be persisted and how.&amp;nbsp; Currently the three different methods of persistence we&amp;#39;re starting with are - ViewState, Session, and Process.&lt;/p&gt;&lt;p&gt;ViewState - this one is pretty self-explanatory&lt;/p&gt;&lt;p style="font-family:courier;"&gt;[Persist(PersistenceType.ViewState)] &lt;/p&gt;&lt;p&gt;Session - this is for page-level session only.&amp;nbsp; It persists the data for as long as the user doesn&amp;#39;t navigate to a different page.&amp;nbsp; The fact that we&amp;#39;ve refactored all our persistence code allows us to implement a very aggressive state management strategy that deletes any session data that does not EXPLICITLY belong at any given time.&lt;/p&gt;&lt;p style="font-family:courier;"&gt;[Persist(PersistenceType.Session)] &lt;/p&gt;&lt;p&gt;Process - this is for state that needs to be maintained across pages.&amp;nbsp; If a page wants to enlist in a shared-state scenario (like a wizard or any sequence of pages the user can move back and forth between).&amp;nbsp; The developer just passes the name of the process to the attribute&amp;#39;s constructor, which assumes a&amp;nbsp;Process persistence.&amp;nbsp; Once again, due to aggressive state management, we immediately delete any process data that isn&amp;#39;t explicitly enlisted in by the currently loading page.&lt;/p&gt;&lt;p style="font-family:courier;"&gt;[Persist(ProcessList.RegistrationProcess)] &lt;/p&gt;&lt;p&gt;For state that needs to be persisted across the user&amp;#39;s entire session, our base Page class will maintain this responsibility.&amp;nbsp; No other code should have this capability.&amp;nbsp; Also note that nothing in our Controllers or business layer can push anything to persistent state.&amp;nbsp; Those layers deal with explicit instructions and methods, some of which may store things in the database, etc, but there&amp;#39;s no concept of a Controller saying, &amp;quot;I want this to be placed in persistent state&amp;quot;.&amp;nbsp; Controllers just manipulate properties and expect them to be stateful.&amp;nbsp; It&amp;#39;s up to the presentation layer to decide how something should be persisted.&amp;nbsp; The difference between WinForms and WebForms is so great that the idea of placing that logic in the Controller makes no sense to us.&lt;/p&gt;&lt;p&gt;As to the performance issues of using Reflection to read and act upon attributes, we feel it&amp;#39;s negligable compared to the benefits.&amp;nbsp; We ran some simple tests, and found that using Attribute-based persistence was approximately 100 times slower than not using Attributes.&amp;nbsp; While that may sound huge, it&amp;#39;s not when you&amp;#39;re talking about the difference (in the worst case) between .00281 and .000228 seconds.&amp;nbsp; Or, in a longer running scenario, between .000268 and .0000363.&amp;nbsp; Not only that, but we&amp;#39;ve researched several methods to make long-running reflection usage far more performant via the use of Reflection.Emit and also ASP.NET 2.0&amp;#39;s Dynamic Methods.&amp;nbsp; Once we&amp;#39;ve solidified other areas of our new architecture, we can go back and tighten the screws.&lt;/p&gt;&lt;p&gt;These changes will increase the visibility and maintainability&amp;nbsp;of our code by allowing any developer to very quickly see exactly what is persisted and how.&amp;nbsp;&amp;nbsp;Having all our persistence logic refactored into one place will eliminate any potential mistakes a developer could make in persisting data, and will increase our agility in extending the functionality in the future.&amp;nbsp; The point is, there&amp;#39;s too much to gain from Reflection not to use it.&lt;/p&gt;&lt;img src="http://experience.fellowshipone.com/aggbug.aspx?PostID=560" width="1" height="1"&gt;</description><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/.NET/default.aspx">.NET</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/State/default.aspx">State</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Persistence/default.aspx">Persistence</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Attributes/default.aspx">Attributes</category></item><item><title>Wrestling an Enterprise Architecture out of .NET</title><link>http://experience.fellowshipone.com/blogs/intelligentdesign/archive/2006/09/22/Enterprise-.NET-architecture.aspx</link><pubDate>Fri, 22 Sep 2006 23:24:00 GMT</pubDate><guid isPermaLink="false">87eee960-b871-44cb-8a98-02588a960c04:219</guid><dc:creator>thardy</dc:creator><slash:comments>3</slash:comments><comments>http://experience.fellowshipone.com/blogs/intelligentdesign/comments/219.aspx</comments><wfw:commentRss>http://experience.fellowshipone.com/blogs/intelligentdesign/commentrss.aspx?PostID=219</wfw:commentRss><description>&lt;p&gt;As a growing &amp;quot;Software as a Service&amp;quot; (SaaS) development shop using .NET we&amp;#39;ve encountered many growing pains and some of the speed bumps inherent in&amp;nbsp;the architecture that many others probably have as well.&amp;nbsp;&amp;nbsp;I&amp;#39;d like to express some of the issues we&amp;#39;ve encountered and hear if anyone else would like to start a dialog on the shortcomings and potential solutions to scaling enterprise .NET development.&amp;nbsp; &lt;/p&gt;&lt;h3&gt;The bigger the code, the bigger the problems&amp;nbsp;&lt;/h3&gt;&lt;p&gt;The typical architectures espoused by .NET aren&amp;#39;t well-designed for large, &amp;quot;always-on&amp;quot;&amp;nbsp;apps.&amp;nbsp;&amp;nbsp;This has become clear to us as our development group and our codebase have grown.&amp;nbsp; SaaS is a big factor here as well, since best-practice is quickly discovered to be a rather tight, incremental release schedule.&amp;nbsp; As our development group scales, and feature demands increase, the framework everything is written in begins to show its strengths and weaknesses.&amp;nbsp; It&amp;#39;s the sort of thing that is difficult to see until many hands have been in the same pot over a period of years.&amp;nbsp; J2EE seems much more geared towards large, enterprise apps, with more emphasis on strict contracts and black boxes.&amp;nbsp;&amp;nbsp;While many of the Java frameworks seem like overkill to most .NET developers, it&amp;#39;s because most .NET developers don&amp;#39;t work on the same codebase for more than a year or two.&amp;nbsp; It seems like Microsoft has made a calculated move to aim squarely between the enterprise and the PHP-type developer&amp;nbsp;communities.&amp;nbsp; We love .NET tools though, and are looking at some foundational architecture changes to tackle these issues.&lt;/p&gt;&lt;h3&gt;Misplaced intelligence&amp;nbsp;&lt;/h3&gt;&lt;p&gt;One of the key difficulties introduced with .NET is the Page-Controller Pattern.&amp;nbsp; Despite how nice and elegant the most common n-Tier .NET architecture sounds on paper, practice shows that a great deal of intelligence (WAY TOO MUCH intelligence) inherently ends up in the code-behind of your pages and user controls, and thus, smack in the middle of your presentation layer.&amp;nbsp; This produces a tight coupling between the presentation and business layers and a lot of business logic in the wrong place.&amp;nbsp;&amp;nbsp;The commonly espoused reason for decreasing this coupling is the ability to completely change the UI layer - say, to take your existing business layer that you used with your Web pages and slap WinForms directly on top of it.&amp;nbsp; While this would be wonderful, the more pressing reason is the simple need to refactor code for maintainability and extensibility.&amp;nbsp; Anything in your code behind pages cannot be reused elsewhere.&amp;nbsp; While having nice business methods in your business layer like &amp;quot;FetchOrdersByCustomer&amp;quot;, or &amp;quot;UpdateProducts&amp;quot; that deal with&amp;nbsp;nice typed objects and collections may make you feel all warm and fuzzy because you have your n-tier bases covered, your architecture bases really aren&amp;#39;t covered at all.&amp;nbsp; Or maybe you have your entities possess the intelligence to manipulate themselves.&amp;nbsp; Either way, the majority of custom development occurs within the consumers of these methods.&amp;nbsp;&amp;nbsp;If the consumers of these methods are in your code behind, you will have real problems as your product grows, your development team grows, and the demands on your product begin to pull it in multiple directions.&amp;nbsp; What you really want is an incredibly stupid presentation layer that only has intelligence about itself.&amp;nbsp; It should only know how to present information from a strictly contracted model it knows nothing about manipulating, how to manage state between &amp;quot;locations&amp;quot; (pages, winforms, pocketPC forms, etc), and how to handle client-side behavior.&amp;nbsp; This is another argument for stupid entities as well (our entities do not know how to manipulate themselves), since our presentation layer can reference our entities without having to worry about exposing all that business logic to the presentation layer.&amp;nbsp; I&amp;#39;m sure I&amp;#39;ll get some disagreements on that, but that&amp;#39;s the beauty of hearing other people&amp;#39;s opinions.&lt;/p&gt;&lt;h3&gt;A possible solution&lt;/h3&gt;&lt;p&gt;The solution we are developing is moving towards something closer to the Model View Controller pattern.&amp;nbsp; Particularly MVC2, which is the same pattern altered for the web.&amp;nbsp; Microsoft&amp;#39;s User Interface Application Block is an MVC block, but MVC does not work on the web.&amp;nbsp; MVC depends on the View being directly updatable from changes to the model, so that combined with the complexity of that application block make it unfeasable for our use.&amp;nbsp; Since the web is stateless, there is no way to directly update your UI from changes to the model.&amp;nbsp; What MVC2 does is simply insert the controller into the process coming from both directions (web to model, and model to web).&amp;nbsp; Microsoft has no packaged solution for anything close to MVC2, which is really disappointing, since you would think they&amp;#39;d want to compete more directly with J2EE and fill this gaping architectural hole.&amp;nbsp; There are some packaged solutions from third parties (even more evidence of a serious development need unmet by Microsoft), such as Maverick.NET &lt;a href="http://mavnet.sourceforge.net/"&gt;http://mavnet.sourceforge.net/&lt;/a&gt;, MonoRail &lt;a href="http://www.castleproject.org/index.php/MonoRail"&gt;http://www.castleproject.org/index.php/MonoRail&lt;/a&gt;,&amp;nbsp;and&amp;nbsp;something called NWAF &lt;a href="http://sourceforge.net/projects/nwaf"&gt;http://sourceforge.net/projects/nwaf&lt;/a&gt;, but all of the above&amp;nbsp;take rather radical departures from the .NET way of doing things and are a big jump for .NET developers.&amp;nbsp; Things like the basic page lifecycle and ViewState are radically changed.&amp;nbsp; We wanted something that wasn&amp;#39;t quite a big leap for our group, yet still gave the major benefits of MVC2.&amp;nbsp; &lt;/p&gt;&lt;p&gt;There has been a pattern that has recently risen to the top of the .NET pattern circles called Model View Presenter (MVP) that attempts to take a stab at MVC2 and still maintain WebForms and ViewState management.&amp;nbsp; I&amp;#39;ve recently read a few articles that mention Microsoft&amp;#39;s CAB (Component UI Application Block) will have some MVP patterns in it, but we&amp;#39;re not holding our breath.&amp;nbsp; It&amp;#39;s also targeted at Smart Clients, so I don&amp;#39;t know how practical it is for pure web-based apps.&lt;/p&gt;&lt;p&gt;We&amp;#39;re building our own home-grown version of an MVP architecture for all development going forward.&amp;nbsp;We are also baking in&amp;nbsp;a few more things that we feel are important, such as:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Typed navigation - urls should never appear in code, and it would be nice if the developer knew the exact state data required in order to navigate to that location/view at compile time&lt;/li&gt;&lt;li&gt;Removing all state-management concerns from the Controller layer - controllers should not care anything about how state is persisted or even have to make the decision that something should be persisted.&amp;nbsp; They should just be able to expect the properties on the View to be available.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;As we get further along, I&amp;#39;ll post some of the pitfalls and breakthroughs we come across.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://experience.fellowshipone.com/aggbug.aspx?PostID=219" width="1" height="1"&gt;</description><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/View/default.aspx">View</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/MVC2/default.aspx">MVC2</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/MVP/default.aspx">MVP</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Model/default.aspx">Model</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Controller/default.aspx">Controller</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/MVC/default.aspx">MVC</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Presenter/default.aspx">Presenter</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://experience.fellowshipone.com/blogs/intelligentdesign/archive/tags/.NET/default.aspx">.NET</category></item></channel></rss>