<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Headspring &#187; Sharon Cichelli</title>
	<atom:link href="http://www.headspring.com/author/scichelli/feed" rel="self" type="application/rss+xml" />
	<link>http://www.headspring.com</link>
	<description>Custom software... Done right the first time.</description>
	<lastBuildDate>Wed, 16 May 2012 18:27:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<copyright>Copyright © Headspring 2012 </copyright>
	<managingEditor>marketing@headspring.com (Jeffrey Palermo and Kevin Hurwitz)</managingEditor>
	<webMaster>marketing@headspring.com (Jeffrey Palermo and Kevin Hurwitz)</webMaster>
	<ttl>1440</ttl>
	<image>
		<url>http://www.headspring.com/wp-content/uploads/2012/05/HeadspringFlair144.jpg</url>
		<title>Headspring</title>
		<link>http://www.headspring.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle>We believe there is a better way</itunes:subtitle>
	<itunes:summary>Are you a lifelong learner?  Are you always searching for better ways to develop and maintain software?  So are we!  A passion for learning and growth is a core value at Headspring.  In this podcast, Headspring consultants, programmers, software developers, managers, and executives share the skills, techniques, patterns, and tools that have proven effective on clients&#039; consulting projects.  Headspring is a software consulting company in Austin, TX and has been recognized on the Inc 500 list and the Austin Business Journal&#039;s Best Place to Work award.</itunes:summary>
	<itunes:keywords>headspring, software, line, business, enterprise, applications, custom, MVC, Net, C, database, SQL</itunes:keywords>
	<itunes:category text="Technology" />
	<itunes:category text="Business" />
	<itunes:category text="Education">
		<itunes:category text="Training" />
	</itunes:category>
	<itunes:author>Jeffrey Palermo and Kevin Hurwitz</itunes:author>
	<itunes:owner>
		<itunes:name>Jeffrey Palermo and Kevin Hurwitz</itunes:name>
		<itunes:email>marketing@headspring.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.headspring.com/wp-content/uploads/2012/05/HeadspringFlair600.jpg" />
		<item>
		<title>MVP vs MVC: Seeking better testability</title>
		<link>http://www.headspring.com/2012/04/mvp-vs-mvc-seeking-better-testability</link>
		<comments>http://www.headspring.com/2012/04/mvp-vs-mvc-seeking-better-testability#comments</comments>
		<pubDate>Wed, 25 Apr 2012 18:53:22 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[mvp]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=5010</guid>
		<description><![CDATA[There&#8217;s something nice about returning to an old design pattern. Comparing it ...]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s something nice about returning to an old design pattern. Comparing it with the pattern you&#8217;re currently using gives you new insights about both.</p>
<p>When I was writing ASP.NET WebForms apps, my team organized the UI layer with an <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter">MVP (Model View Presenter)</a> pattern, preferring the Passive View variant. This allowed us to write Views that were small and lean, pulling as much logic as possible out of that untestable wasteland of UI markup and code-behind. More recently, I&#8217;ve been developing ASP.NET MVC applications (using the <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC (Model View Controller)</a> pattern, naturally), and I like how my Views can be straightforward HTML with a few fill-in-the-blank spots for the data I want to display; much simpler to understand than the old WebForms server controls. But my most recent project, I wrote in <a href="http://windowsclient.net/wpf/">WPF (Windows Presentation Foundation)</a> due to some specific needs of the client, and I had to re-open the UI design pattern question.<span id="more-5010"></span> I decided on MVP, and this gave me a great opportunity to contrast the two patterns.</p>
<p>My goal in choosing <em>any</em> pattern is readable, understandable code. Even if I&#8217;m the only developer on the project, reading my own code, if six months have elapsed, it might as well have been written by someone else. Patterns inherently give structure, but more importantly, they are recognizable. Reading the code, you can spot it: &#8220;Oh! This is an MVP app. Okay, I&#8217;ll look for a Presenter class to be managing the interactions with the View. &#8230;There it is!&#8221; Future maintainers and enhancers (including your Future Self) will appreciate your consistency; patterns help you write &#8220;No Surprises&#8221; software. Both MVP and MVC meet this criterion; they are recognizable patterns, each with a distinctive fingerprint.</p>
<p>My secondary pattern-choosing criterion is testability: How well does this pattern let me cover every interesting part of my app with unit tests? While I see the value in integration tests and full-system tests, I&#8217;m strongly prejudiced against them. Integration tests are finicky, and full-system tests are slow. I&#8217;m unapologetically feisty about my unit tests. The better pattern is the one that not only makes it easy to test, but makes it <em>hard</em> to write untestable code. In other words, prefer the pattern that leads your team to fall into the &#8220;<a href="http://blogs.msdn.com/b/brada/archive/2003/10/02/50420.aspx">pit of success</a>.&#8221; MVC beats MVP on this point. Let me explain.</p>
<p>Consider a continuum, from Untestable Scary Code to Clean, Verified Code. WebForms without the rigor of an MVP pattern, with heavy reliance on the code-behind, is far on the left of that continuum. A lot of business logic and application flow control can be hidden in the least testable layer. When you apply MVP to your WebForms app, the pattern guides you to write very slim code-behind files, with methods that are usually one line long, immediately deferring to the Presenter. This is closer to the middle of the continuum, where you can test your Presenters, provided you trust your Views to remain humble and hand over control promptly. MVC, as implemented by the ASP.NET MVC framework, gives you <strong>no code-behind files</strong>. There&#8217;s no temptation to put logic into the View because there&#8217;s hardly anywhere to put it. Control logic naturally fits in the Controller, which is a plain class you can instantiate and exercise in a unit test. The easiest path produces the cleanest result. Nice.</p>
<p>Why did I use MVP at all? It&#8217;s necessary in a framework that brings the View into existence first. Both WebForms and WPF start a conversation with the user by locating and instantiating a View. The View then constructs its Presenter and injects itself into it. MVC implementations start by instantiating a Controller. Unlike MVP Views, which have to talk to their Presenters, MVC Views can remain ignorant of their Controllers, and this allows them to stay logic-free and focused on rendering the UI. When using MVP, it takes vigilance to make sure your Views never do anything interesting, anything you&#8217;ll later wish you had covered with a unit test. And anything that takes vigilance is likely to drift over time.</p>
<p>It was fun to revisit my &#8220;old&#8221; way of structuring applications, because it made me think critically about the relative merits of MVP versus MVC. I had an instinctive feeling for which one I preferred, and comparing them helped me see explicitly that MVC increases my confidence in the correctness of my team&#8217;s code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/04/mvp-vs-mvc-seeking-better-testability/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How Not to Say &#8220;Um&#8221; When Presenting</title>
		<link>http://www.headspring.com/2012/03/how-not-to-say-um-when-presenting</link>
		<comments>http://www.headspring.com/2012/03/how-not-to-say-um-when-presenting#comments</comments>
		<pubDate>Tue, 20 Mar 2012 15:35:30 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Bonus!]]></category>
		<category><![CDATA[frontpage]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=4170</guid>
		<description><![CDATA[I&#8217;ll start with the tip, then unpack the reason why it works ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll start with the tip, then unpack the reason why it works and explain how to apply it. To avoid those hemming and hawing filler words—um, y&#8217;know, like—and give your presentations the polish of eloquence:<span id="more-4170"></span></p>
<blockquote style="margin: 3em; font-size: 1.5em;"><p>Make eye contact.</p></blockquote>
<h2>An Excursion into Psycholinguistics</h2>
<p>To avoid filler words, it helps to understand why we say them, which falls under the domain of <a href="http://en.wikipedia.org/wiki/Psycholinguistics">psycholinguistics</a>.</p>
<p>When you and I are having a conversation, we take turns speaking, and we use a variety of verbal and non-verbal cues to signal when to switch. I&#8217;ll ask a question and then pause, and you instinctively know that it is your turn to talk. While you&#8217;re telling a story, you&#8217;ll pause periodically to see if I am following, and I will make an encouraging sound (&#8220;mm hm&#8221; or &#8220;go on&#8221;) to confirm that it is still your turn. You might say something that sparks an idea in me that I very much want to share, and the changes in my facial expression—bright eyes and an intake in breath—convey my request to have a turn. If I get these cues wrong and repeatedly speak during what you consider <em>your turn</em>, you will think I&#8217;m rude and interrupty.</p>
<p>Note that most of those transitions were signaled by a pause. To avoid being interrupted, when you need a moment to organize your thoughts but are not ready to relinquish your turn, you&#8217;ll phonate (fancy linguist term for &#8220;make noise with your speech apparatus&#8221;). You don&#8217;t have any words to say, but you want to fill the silence to retain your hold on the conversation, so you&#8217;ll use meaningless words. You&#8217;ll say &#8220;um.&#8221;</p>
<h2>Maintaining Your Turn While Presenting</h2>
<p>Consider how turn negotiation changes when you are presenting in front of an audience. Your instincts tell you that a pause will cause you to lose your turn, but in reality, you&#8217;re on stage. It&#8217;s your show. We in the audience have granted you an extended turn. You would feel uncomfortable in a one-on-one conversation talking for 20 minutes without exchanging turns, but it is normal, expected, and exactly appropriate during a presentation.</p>
<p>How do you override the unconscious desire to say &#8220;um&#8221; to maintain your turn? You make eye contact with your audience members. Deliberate, focused eye contact. Avoid scattershot scans over their heads or a fixated stare at the clock on the back wall. Instead, look at the members of your audience. Deliver a clause or a whole sentence to one person, then connect with another person for the next. Two beneficial side-effects are better reception from your audience and improved pacing in your delivery. Deliberate pauses become built in as you deliver points to different individuals.</p>
<p>When you make eye contact, your unconscious mind gets direct evidence that it is still your turn. You can see that there are no bids from the audience. You can feel the audience&#8217;s attention. That need to fill pauses with noise melts away.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/03/how-not-to-say-um-when-presenting/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Improve your LINQ with .Any()</title>
		<link>http://www.headspring.com/2012/02/improve-your-linq-with-any</link>
		<comments>http://www.headspring.com/2012/02/improve-your-linq-with-any#comments</comments>
		<pubDate>Tue, 21 Feb 2012 15:31:48 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=3662</guid>
		<description><![CDATA[LINQ&#8217;s .Any() method is under-utilized, given the benefits it brings in making ...]]></description>
			<content:encoded><![CDATA[<p>LINQ&#8217;s <code>.Any()</code> method is under-utilized, given the benefits it brings in making your code briefer, clearer, and more efficient. LINQ in general improves the expressiveness of your collection-manipulating code by using declarative statements instead of imperative <code>foreach</code> loops; <code>.Any()</code> is a great tool in that regard.</p>
<p>Here&#8217;s a representative example:</p>
<div id="gist-1877234" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kt">bool</span> <span class="n">hasMissedDeadlines</span> <span class="p">=</span> <span class="n">deliverables</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">.</span><span class="n">Where</span><span class="p">(</span><span class="n">d</span> <span class="p">=&gt;</span> <span class="n">d</span><span class="p">.</span><span class="n">Deadline</span> <span class="p">&lt;</span> <span class="n">_systemClock</span><span class="p">.</span><span class="n">Today</span><span class="p">)</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">.</span><span class="n">Count</span><span class="p">()</span> <span class="p">&gt;</span> <span class="m">0</span><span class="p">;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1877234/8328038d51c8f65ea01742a30e8722dd418093cc/UsingWhereAndCount.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1877234#file_using_where_and_count.cs" style="float:right;margin-right:10px;color:#666">UsingWhereAndCount.cs</a>
            <a href="https://gist.github.com/1877234">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>I want to determine if my to-do list has any items that are late, so I use <code>.Where()</code> to filter my list of deliverables down to items with a deadline in the past; then I take a <code>.Count()</code> of the resulting list, and see if that number is greater than zero. This is a plausible solution, and our years of SQL lead us to write LINQ this way. But it can be better.<span id="more-3662"></span></p>
<p>Testing &#8220;count greater than zero&#8221; is a programmer&#8217;s way of saying &#8220;are there any?&#8221; So let&#8217;s just say <em>any</em>. As you might expect, <code>.Any()</code> returns a Boolean indicating whether the collection contains any items. Further, you can pass a lambda expression to specify the predicate &#8220;any <em>like this</em>.&#8221; (<code>.Count()</code> takes a predicate, too, by the way, but I really have seen &#8220;<code>.Where().Count()</code>&#8221; in use, so I wanted to start from there.)</p>
<p>Here&#8217;s the new version:</p>
<div id="gist-1877236" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kt">bool</span> <span class="n">hasMissedDeadlines</span> <span class="p">=</span> <span class="n">deliverables</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;<span class="p">.</span><span class="n">Any</span><span class="p">(</span><span class="n">d</span> <span class="p">=&gt;</span> <span class="n">d</span><span class="p">.</span><span class="n">Deadline</span> <span class="p">&lt;</span> <span class="n">_systemClock</span><span class="p">.</span><span class="n">Today</span><span class="p">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1877236/8ac9436c90704421cc9d8aa29617559f3fd28a8c/UsingAny.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1877236#file_using_any.cs" style="float:right;margin-right:10px;color:#666">UsingAny.cs</a>
            <a href="https://gist.github.com/1877236">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>In addition to being shorter, this version more directly and declaratively states my intent: &#8220;Are there any late deliverables?&#8221;</p>
<p>This code also executes more efficiently. For <code>.Count()</code> to return a value, LINQ must iterate over all items in the collection, even though I don&#8217;t care <em>how many</em> items there are. <code>.Any()</code> will return as soon as it encounters an item that satisfies the predicate. It evaluates as few items as possible, giving me an efficient and readable solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2012/02/improve-your-linq-with-any/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuous Integration: Early indicators mean inexpensive fixes</title>
		<link>http://www.headspring.com/2011/12/continuous-integration-early-indicators-mean-inexpensive-fixes</link>
		<comments>http://www.headspring.com/2011/12/continuous-integration-early-indicators-mean-inexpensive-fixes#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:27:52 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[frontpage]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=2350</guid>
		<description><![CDATA[Earlier this year, I bought a car—my first new car. Although it ...]]></description>
			<content:encoded><![CDATA[<p>Earlier this year, I bought a car—my first <em>new</em> car. Although it fills me with sanctimonious hybrid glee (it really does), it&#8217;s making me neurotic with instrument panel indicator lights. The low-tire-pressure indicator after the weather turned cold. The insistent exclamation point from the airbag computer in my seat. The glaring amber beacon from the Integrated Motor Assist battery. I&#8217;ve never had so many things go wrong with a car!</p>
<p>Or have I?</p>
<p>Incorporating automated tests into your Continuous Integration build process can feel similar. You&#8217;re suddenly presented with all these errors. Your product seems to be broken all the time. You liked it better when things were quiet and you didn&#8217;t know how bad it was.<span id="more-2350"></span></p>
<p>There are two reasons I&#8217;m getting so many warnings from my car: It has more systems, more features, more <em>computers</em> than any car I&#8217;ve owned before; and it has more health sensors and warning lights. It&#8217;s better at knowing when it&#8217;s a little unhappy, and better at letting me know. I take care of these little maintenance tasks, and all is well. It never reaches the big, blow-up, throw-a-rod, leave-you-stranded, heartache-on-the-interstate meltdown that results from years of indifferent neglect.</p>
<p>Continuously run unit tests are an army of little health sensors. CI feels painful at first, but it pays off quickly. When the system under test wavers, even minutely, the tests catch it promptly and summon your attention while it is still a small, containable, inexpensive problem. (Provided they&#8217;re running frequently. Once a day is pretty infrequent. Strive to make them fast enough that you&#8217;re willing to run them every time you commit to source control.) Continuous Integration tests keep your problems on the scale of oil changes and tire pressure, instead of engine blocks and radiators.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/12/continuous-integration-early-indicators-mean-inexpensive-fixes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best-Kept Secret: MS Word&#8217;s Selection Pane saves time, reduces frustration</title>
		<link>http://www.headspring.com/2011/11/best-kept-secret-ms-words-selection-pane-saves-time-reduces-frustration</link>
		<comments>http://www.headspring.com/2011/11/best-kept-secret-ms-words-selection-pane-saves-time-reduces-frustration#comments</comments>
		<pubDate>Tue, 22 Nov 2011 15:54:42 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[What the tech?]]></category>
		<category><![CDATA[efficiency]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=2278</guid>
		<description><![CDATA[It&#8217;s probably because I never learned to play first-person shooters, but I ...]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s probably because I never learned to play first-person shooters, but I have a devil of a time in Word selecting the element I want out of a page full of drawing shapes. Trying to select a text box, I click on what I think is that one-pixel box border, and end up selecting the canvas behind it, or a nearby rectangle, or nothing at all. Have you experienced this frustration? I&#8217;ve even resorted to &#8220;Send to Back&#8221; to get something out of my way so that I can select the thing I want.</p>
<p>I stumbled onto the solution. To explain it, I have made a <a href="http://www.youtube.com/watch?v=1puMOp7d-kk">video demo of MS Word&#8217;s Selection Pane</a> feature.<span id="more-2278"></span></p>
<p><iframe width="500" height="281" src="http://www.youtube.com/embed/1puMOp7d-kk?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>On the ribbon bar, select the Page Layout tab. Look within the Arrange group, towards the right, and click the Selection Pane button. That opens the Pane, which lists all drawing objects that are on the current page.</p>
<p>From the Selection Pane, you can easily click the name of the item you want, and that will select it. From there, you can change formatting options or adjust its position with your keyboard.</p>
<p>It brings some extra features, too. Click the eye image next to an item to hide and show it, similar to Photoshop. Drag items to reorder them, which changes their z-index, bringing items in front of others.</p>
<p>I was so delighted when I found that button. It changed my day from one of grumbling at my mouse to calling my coworkers over to show &#8216;em. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/11/best-kept-secret-ms-words-selection-pane-saves-time-reduces-frustration/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Legacy Operating Systems and Legacy Languages: If it ain&#8217;t broke, it still needs fixing</title>
		<link>http://www.headspring.com/2011/08/legacy-operating-systems-and-legacy-languages-if-it-aint-broke-it-still-needs-fixing</link>
		<comments>http://www.headspring.com/2011/08/legacy-operating-systems-and-legacy-languages-if-it-aint-broke-it-still-needs-fixing#comments</comments>
		<pubDate>Thu, 25 Aug 2011 13:39:01 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[What the tech?]]></category>
		<category><![CDATA[legacy software]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=1555</guid>
		<description><![CDATA[In my travels I&#8217;ve encountered systems chugging happily along on outdated, discontinued, ...]]></description>
			<content:encoded><![CDATA[<p>In my travels I&#8217;ve encountered systems chugging happily along on outdated, discontinued, unsupported technology stacks. Apps written in VB6, FoxPro, Classic ASP, still running without a hitch because the kinks had been shaken out years ago&#8230; Software users delicately avoiding upgrading their Windows 95 machine because it does what they need, in a manner they understand, running the apps they&#8217;ve built their business on&#8230; As a techie, the idea makes your hair curl, but the thing is: these applications <em>work</em>. They&#8217;ve been working, and they give the appearance of continuing to work indefinitely.<span id="more-1555"></span></p>
<p>It&#8217;s an illusion, though. I sympathize with getting taken in by that illusion. After all, I&#8217;ve owned the same cell phone for seven years—I don&#8217;t mind that it doesn&#8217;t do the <em>latest</em> stuff because it does everything I need (makes phone calls). To replace it, just because someone else has something shinier, sounds ridiculous. I&#8217;m the same way with cars, computers, furniture: I evaluate an item&#8217;s utility against my own needs, not something else&#8217;s capabilities. Taking the same view of your software applications can seem like good sense.</p>
<p>Here&#8217;s the difference with software. Factors outside your control can make your application stop working. This is especially true when it is running on a legacy operating system or a legacy language.</p>
<p>I just had a sharp lesson in this on one of my personal websites. My site uses a content-management system written in PHP, which I had allowed to drift a bit behind on version updates. Last weekend my webhost, quite reasonably, upgraded their servers with the latest stable version of PHP. They had notified me, so I was looking out for it, and sure enough: my site was broken. My outdated version of the content-management system was calling deprecated and discontinued PHP methods. To drive the lesson home, I was enough out of date that upgrading the content-management system wasn&#8217;t trivial, either. Here is a case where &#8220;if it ain&#8217;t broke&#8221; turned into &#8220;it&#8217;s broke anyway.&#8221;</p>
<p>Keeping software platforms current is not about wanting the latest features. It is about routine maintenance that keeps your critical systems comfortably supported. If you fall behind the pack, software patches and operating system upgrades offer no guarantees. That&#8217;s what it means when a technology is no longer supported: it means the manufacturer won&#8217;t be testing whether their latest change will impact that end-of-life technology. Complacency is perilous.</p>
<p>You might find it daunting to estimate the value of rewriting an application in a supported language. The cost is plain, but what is the return? It can sound like spending considerable time and resources to end up with the same feature set. We have helped some of our clients make such an assessment, so that they can decide when it is prudent to bring their technology stack up to date. <a href="http://www.headspring.com/services/consulting-development">Please get in touch</a> if you are weighing similar trade-offs.</p>
<p>In order to make an informed decision, consider what it would cost to lose the application, to have it rendered non-functional—even non-starting—by an environment change. Is the application critical to your business? Is it your business&#8217;s product? What would it cost to lose it? Keeping current is insurance against that cost.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/08/legacy-operating-systems-and-legacy-languages-if-it-aint-broke-it-still-needs-fixing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When to Use a Rhino Mock, and When Not To</title>
		<link>http://www.headspring.com/2011/08/when-to-use-a-rhino-mock-and-when-not-to</link>
		<comments>http://www.headspring.com/2011/08/when-to-use-a-rhino-mock-and-when-not-to#comments</comments>
		<pubDate>Mon, 22 Aug 2011 16:26:05 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[rhino mocks]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=1492</guid>
		<description><![CDATA[When I sit down to write a unit test, my first step ...]]></description>
			<content:encoded><![CDATA[<p>When I sit down to write a unit test, my first step is to describe for myself, in English instead of code, what I intend to test. The words I choose give clues as to the structure of the test and the style: interaction-based versus state-based. I&#8217;ll describe an example below.</p>
<p>RhinoMocks, and other mocking frameworks like Moq and TypeMock, are a support structure that let you write briefer, more expressive unit tests. RhinoMocks simplifies the quick creation of fake classes that your class under test relies on and interacts with. You can use those fakes for both styles of tests; RhinoMocks can make assertions about interactions in interaction-based tests, and it can provide non-exception-throwing behavior when you just need a stand-in for your state-based tests. I listen to the language of my description to know how I want to use that Rhino Mock.</p>
<p>For example, your application might have an EmailDispatcher that decides which emails to send, then calls an EmailService to send the emails. You&#8217;d like to unit test the logic in the EmailDispatcher without sending thousands of real emails. This is a perfect scenario for RhinoMocks.<span id="more-1492"></span> RhinoMocks can build you a fake EmailService when your tests are running, and let you make assertions about when the EmailDispatcher calls that EmailService. RhinoMocks allows you to assert &#8220;When the EmailDispatcher is given input like <em>this</em>, it should call the EmailService with <em>that</em> info.&#8221;</p>
<p>Another great use for RhinoMocks is to support a class that has dependencies that aren&#8217;t interesting to the test you are writing—the class under test calls some other classes, but they aren&#8217;t relevant to the scenario you are testing. You merely need them to not be null and not throw Null Reference Exceptions when your test is running. Continuing with the above example, the EmailDispatcher could rely on a TemplateFormatter class to prepare the text of the email, but because you are writing a test fixture focusing on when emails get sent, and you are not testing how those emails are formatted, the TemplateFormatter should be as low profile in your test as possible. If TemplateFormatter is a simple class, you could just instantiate one and pass it to your EmailDispatcher under test. On the other hand, if TemplateFormatter requires its own swarm of dependencies, or if some of its operations rely on time-consuming, out-of-process dependencies like a database, replacing it with a fake class generated by RhinoMocks will keep your unit test quick and brief.</p>
<p>What is an example of misusing a Rhino Mock? Where RhinoMocks becomes a burden is when it over-specifies the interactions between classes. RhinoMocks can make assertions about how one class calls another, which is its power and its danger. This excessive over-specification inhibits refactoring because it entrenches the coupling between those classes—you&#8217;d want to change the internals of one class, but that would break so many tests and require tedious fixing of those tests, dissuading you from making the refactoring. Anything that makes you queasy about doing the right thing is a bad deal. From the EmailDispatcher example, I do want to test that emails are well formatted, but I don&#8217;t really care whether this is done by a TemplateFormatter, or some other class, or an EmailDispatcher method, or a private class within the EmailDispatcher, or&#8230; whatever. I don&#8217;t need to enforce the method by which the EmailDispatcher accomplishes its work, therefore I don&#8217;t want to write tests that enforce the way emails get formatted.</p>
<p>My rule of thumb is to tell myself, in English, what I want to verify and listen to the words I choose. Here are two examples.</p>
<p>&#8220;I want to test <em>when</em> the EmailDispatcher <em>tells</em> the EmailSender to send mail.&#8221; I used words that refer to testing the conditions under which one class calls another. Therefore, I&#8217;ll write an interaction-based test, using RhinoMocks&#8217; AssertWasCalled and AssertWasNotCalled methods.</p>
<p>&#8220;I want to test that the <em>result</em> from the EmailDispatcher&#8217;s work is an email in a <em>certain format</em>.&#8221; Looking at the properties on the result of an operation is a good fit for state-based tests. I&#8217;ll probably still use RhinoMocks to create a fake EmailSender, since I know the EmailDispatcher is going to call the EmailSender at the end, but I am not going to make any assertions about the methods called by the EmailDispatcher.</p>
<p>There&#8217;s lots of great power in RhinoMocks, where it can give you just the right tool&#8230; or enough rope to hang yourself. We talk about responsible Rhino Mocking in our <a href="http://www.headspring.com/services/developer-training/agile-bootcamp">Agile Bootcamp</a>, and I&#8217;ll be presenting some of the <a href="http://www.ctxdnug.net/Meetings/October-2011-Meeting.aspx">finer points of RhinoMocks at the Central Texas .NET User Group on October 13</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/08/when-to-use-a-rhino-mock-and-when-not-to/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>True Confessions, Public Shaming, and Test-Driven Development</title>
		<link>http://www.headspring.com/2011/07/true-confessions-public-shaming-and-test-driven-development</link>
		<comments>http://www.headspring.com/2011/07/true-confessions-public-shaming-and-test-driven-development#comments</comments>
		<pubDate>Fri, 29 Jul 2011 16:37:32 +0000</pubDate>
		<dc:creator>Sharon Cichelli</dc:creator>
				<category><![CDATA[Bonus!]]></category>
		<category><![CDATA[Developer Deep Dive]]></category>
		<category><![CDATA[continuous improvement]]></category>
		<category><![CDATA[developer productivity]]></category>
		<category><![CDATA[test-driven development]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.headspring.com/?p=989</guid>
		<description><![CDATA[Okay, I admit it. Sometimes I write unit tests second instead of ...]]></description>
			<content:encoded><![CDATA[<p>Okay, I admit it. Sometimes I write unit tests second instead of first. I also bite my nails and rest my elbows on the dinner table. But when I&#8217;ve got a bug to fix, and I&#8217;ve already found the offending line, I can hardly resist the urge to just&#8230; just&#8230; <em>change</em> it. I&#8217;ll follow up with unit tests afterwards, promise.</p>
<p>I admit this to you because admitting my wrongs is a step towards rehabilitation. I admit this to save you pain. Learn from my example. Test-second is so much less efficient than test-first. Consider the following workflow:</p>
<ol>
<li>Reproduce, identify, debug the issue.</li>
<li>Fix the code.</li>
<li>Compile and try it out.</li>
<li>Write a test that proves I fixed it.</li>
<li>Compile and run the test.</li>
<li>Change the code back to make sure my test really proves what it is trying to prove.</li>
<li>Compile and see the test fail.</li>
<li>Re-fix the code.</li>
<li>Compile and see the test pass.</li>
</ol>
<p>&nbsp;</p>
<p>I humble myself before you. How much time am I wasting there? It&#8217;s embarrassing.<span id="more-989"></span></p>
<p>There&#8217;s also a subtle point in step 1. What if I could use unit tests instead of the debugger to find the issue? That will be faster, too.</p>
<p>We can do better:</p>
<ol>
<li>Reproduce the issue and formulate a theory.</li>
<li>Write a test that exercises the theory.</li>
<li>Compile and see the test fail, corroborating the theory.</li>
<li>Fix the code.</li>
<li>Compile and see the test pass, validating the theory.</li>
</ol>
<p>&nbsp;</p>
<p>Perhaps you can relate. Perhaps you even bite your nails, too. I won&#8217;t judge. Flog me or join me, the comments are open: Confess your bad habits (um, your <em>unit-testing</em> bad habits, please), and commit yourself to improvement. I challenge you to improve your efficiency and write your unit tests first, even—especially—for the little bug fixes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.headspring.com/2011/07/true-confessions-public-shaming-and-test-driven-development/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.headspring.com @ 2012-05-18 12:54:19 -->
