<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Lessons Learned</title>
        <link>http://geekswithblogs.net/LessonsLearned/category/8476.aspx</link>
        <description>I've learned a lesson, and have preserved it for posterity. </description>
        <language>en-US</language>
        <copyright>Randolpho St. John</copyright>
        <managingEditor>randolpho@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Don't Use NOLOCK, Use HOLDLOCK</title>
            <link>http://geekswithblogs.net/LessonsLearned/archive/2008/08/28/dont-use-nolock-use-holdlock.aspx</link>
            <description>Normally I very much agree with the things &lt;a href="http://www.codinghorror.com"&gt;Jeff Atwood&lt;/a&gt; has to say. In the case of &lt;a href="http://www.codinghorror.com/blog/archives/001166.html"&gt;this post&lt;/a&gt;, however, I must take issue. What begins with a decent intro into the concept of deadlocks eventually ends with Jeff deciding to use the NOLOCK &lt;a href="http://msdn.microsoft.com/en-us/library/ms187373.aspx"&gt;table hint&lt;/a&gt; to allow dirty reads of a table that had been locked by an update statement. He concludes with a complaint that Microsoft seems to think that &lt;a href="http://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt; is a banking institution and therefore worthy of data integrity instead of the mere programmers blog/wiki/link exchange that it really is. &lt;br /&gt;
&lt;br /&gt;
Jeff wildly misses the mark with his conclusion, in my opinion. &lt;br /&gt;
&lt;br /&gt;
Not only is NOLOCK deprecated, Jeff seems to believe that data integrity is something one can safely do without "in certain scenarios". He is wrong. Every database not only deserves but &lt;span style="font-style: italic;"&gt;requires &lt;/span&gt;data integrity. &lt;br /&gt;
&lt;br /&gt;
Of the dozens of posts that replied to Jeff's article, a few diagnosed the real issue (long updating transactions) but only one (at least as of the time of this post) supplied the correct solution (in my opinion) to Jeff's problem. The poster's name was Filip and &lt;a href="http://foxtricks.blogspot.com/"&gt;his blog&lt;/a&gt; is worth adding to your feed reader. The solution Filip pointed out is simple: Lock all your resources *before* you update them and put a waiting lock on them (HOLDLOCK) so that queries that want to use the resource wait until the update is done rather than dying petulantly.&lt;br /&gt;
&lt;br /&gt;
UPDATE:&lt;br /&gt;
&lt;br /&gt;
Sam Saffron (also another great addition to your feed reader) has &lt;a href="http://www.samsaffron.com/archive/2008/08/27/Deadlocked+"&gt;posted an excellent rebuttal&lt;/a&gt; of Jeff's post explaining how and why deadlocks occur when selecting against an update and how to deal with them. Read it and remember it.&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124752"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124752" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/LessonsLearned/aggbug/124752.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Randolpho St. John</dc:creator>
            <guid>http://geekswithblogs.net/LessonsLearned/archive/2008/08/28/dont-use-nolock-use-holdlock.aspx</guid>
            <pubDate>Thu, 28 Aug 2008 14:36:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LessonsLearned/comments/124752.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LessonsLearned/archive/2008/08/28/dont-use-nolock-use-holdlock.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LessonsLearned/comments/commentRss/124752.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Hidden Surprises in .NET 3.5 Service Pack 1</title>
            <link>http://geekswithblogs.net/LessonsLearned/archive/2008/08/21/hidden-surprises-in-.net-3.5-service-pack-1.aspx</link>
            <description>Ok, imagine the following situation:&lt;br /&gt;
&lt;br /&gt;
You are a developer and you want to keep up with the latest technology, so you update Visual Studio 2008 with &lt;a href="http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx" target="_blank"&gt;Service Pack 1&lt;/a&gt;, installing .NET 3.5 Service Pack 1 as part of the update. You then proceed to continue with your ASP.NET application, building a nice neat AJAXy application. Everything works fine on your box, it's awesome, the in-your-cube demos go great, everybody's happy. So you build and deploy your new hotness then sit back and wait for the pats on the back. &lt;br /&gt;
&lt;br /&gt;
The pats never come. Instead, you get reports of exceptions being thrown by the application every request. Something has gone horribly wrong. It's always the same exception:&lt;br /&gt;
&lt;div style="margin-left: 40px;"&gt;
&lt;pre&gt;&lt;pre&gt;Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly &lt;br /&gt;'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, &lt;br /&gt;PublicKeyToken=31bf3856ad364e35'.&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
You are stymied. You've never heard of the class; you certainly don't use it in your code. You use &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptreference.aspx" target="_blank"&gt;ScriptReference&lt;/a&gt;, of course; who doesn't? But what's &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptreferencebase.aspx" target="_blank"&gt;ScriptReferenceBase&lt;/a&gt;? Going to the documentation for ScriptReferenceBase, you learn that it is the parent class of ScriptReference and &lt;a id="ctl00_rs1_mainContentContainer_ctl29" onclick="javascript:Track('ctl00_rs1_mainContentContainer_cpe504405_c|ctl00_rs1_mainContentContainer_ctl29',this);" href="http://msdn.microsoft.com/en-us/library/system.web.ui.compositescriptreference.aspx" target="_blank"&gt;&lt;span class="nu"&gt;&lt;/span&gt;CompositeScriptReference&lt;/a&gt;. What? No it isn't! The documentation for ScriptReference clearly indicates that it's parent is &lt;a href="http://msdn.microsoft.com/en-us/library/system.object.aspx" onclick="javascript:Track('ctl00_rs1_mainContentContainer_cpe490095_c|ctl00_rs1_mainContentContainer_ctl108',this);" id="ctl00_rs1_mainContentContainer_ctl108" target="_blank"&gt;System&lt;span class="cs"&gt;&lt;/span&gt;&lt;span class="vb"&gt;&lt;/span&gt;&lt;span class="cpp"&gt;&lt;/span&gt;&lt;span class="nu"&gt;.&lt;/span&gt;Object&lt;/a&gt;! What's going on here?&lt;br /&gt;
&lt;br /&gt;
Then you notice the Version Information for ScriptReferenceBase: "Supported in: 3.5 SP1". It's a new class for Service Pack 1. It doesn't exist in .NET 3.5 and the documentation for ScriptReference is clearly stale. &lt;br /&gt;
&lt;br /&gt;
Following a hunch, you double-check your server... yep. Due to red tape, SP1 hasn't been installed on the server. It turns out that when you compiled your code with the SP1 ScriptReference, you built a reference to ScriptReferenceBase and that class just isn't on the server. The solution is simple: install SP1 on the server. &lt;br /&gt;
&lt;br /&gt;
Except you can't upgrade to SP1! Internal circumstances (i.e. no time for regression testing) means no upgrade. So no biggie; you return to Visual Studio 2008 and decide to target .NET 3.5 rather than .NET 3.5 SP1. &lt;br /&gt;
&lt;br /&gt;
Except, surprise! You can't. Visual Studio will target .NET 3.0 and 2.0, but it won't let you differentiate between .NET 3.5 and .NET 3.5 SP1. OUCH.&lt;br /&gt;
&lt;br /&gt;
So what do you do? At this point, your options are limited. The best option is to install SP1 on the server, but sometimes internal pressures won't allow that. Other options include uninstalling SP1 from your box and recompiling -- good luck with that one! -- and finding an unadulterated version of VS 2008 somewhere (a co-worker's box, maybe a virtual machine) and compiling there.&lt;br /&gt;
&lt;br /&gt;
So why am I writing about this hypothetical situation? Because it happened to me, of course! I learned an important lesson. Maybe you can too.&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124605"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124605" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/LessonsLearned/aggbug/124605.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Randolpho St. John</dc:creator>
            <guid>http://geekswithblogs.net/LessonsLearned/archive/2008/08/21/hidden-surprises-in-.net-3.5-service-pack-1.aspx</guid>
            <pubDate>Thu, 21 Aug 2008 15:15:29 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LessonsLearned/comments/124605.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LessonsLearned/archive/2008/08/21/hidden-surprises-in-.net-3.5-service-pack-1.aspx#feedback</comments>
            <slash:comments>14</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LessonsLearned/comments/commentRss/124605.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Whose Fault Are Poor Requirements?</title>
            <link>http://geekswithblogs.net/LessonsLearned/archive/2008/07/28/whose-fault-are-poor-requirements.aspx</link>
            <description>&lt;p&gt;I had thought I would do my first Lesson Learned about my control for the upcoming &lt;a href="http://geekswithblogs.net/LessonsLearned/archive/2008/07/24/silverlight-contest.aspx"&gt;Silverlight Contest&lt;/a&gt;, but recent events changed my mind.&lt;/p&gt;
&lt;p&gt;A phrase has been bandied about alot at work lately, a phrase we've all heard and uttered in one form or another at least once in our software careers. It exists in numerous variations, but essentially boils down to this: &lt;/p&gt;
&lt;p&gt;"The software is bad because the requirements were bad." &lt;/p&gt;
&lt;p&gt;I've seen it happen far too often: somebody complains that "&amp;lt;x&amp;gt; is broken" and the original developer goes on the defensive, blaming the customer for handing him faulty requirements. "It's not my fault! The customer &lt;em&gt;asked&lt;/em&gt; for a button that rebooted the server! All I did was give them exactly what they wanted!"&lt;/p&gt;
&lt;p&gt;I wholeheartedly disagree with this line of thinking. Claiming bad requirements is a copout. &lt;/p&gt;
&lt;p&gt;We as developers have a responsibiltiy to find out why every feature is requested. We must get beyond that "I press a button and it does exactly what I'm thinking" requirement to the heart of the request. If you are handed a requirements document that doesn't make sense &lt;strong&gt;push back&lt;/strong&gt;. Seek clarification. Learn more about the problem domain. Call the architect and tell him he's crazy, that it'll never work. And when you finally understand what the &lt;u&gt;real&lt;/u&gt; requirement is, &lt;strong&gt;write it down&lt;/strong&gt;. Save it for posterity. Communicate it with all parties. Find common ground. It can be done. &lt;/p&gt;
&lt;p&gt;"But my boss told me to do it that way or I'd be fired!" you might say. Very true, but that's bad management, not bad requirements. That's a different copout. &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/devil_smile.gif" /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124086"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124086" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/LessonsLearned/aggbug/124086.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Randolpho St. John</dc:creator>
            <guid>http://geekswithblogs.net/LessonsLearned/archive/2008/07/28/whose-fault-are-poor-requirements.aspx</guid>
            <pubDate>Tue, 29 Jul 2008 03:33:04 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LessonsLearned/comments/124086.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LessonsLearned/archive/2008/07/28/whose-fault-are-poor-requirements.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LessonsLearned/comments/commentRss/124086.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>