<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Testing assumptions with preconditions</title>
	<atom:link href="http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Sat, 25 May 2013 16:53:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2452</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Thu, 27 May 2010 12:15:37 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2452</guid>
		<description>@Martin

Yep, it&#039;s an assumption, but also the simplest thing that could possibly work.  I still don&#039;t introduce duplication, that would be bad.  But I don&#039;t really see the point of allowing this value to be configurable, when no one needs it to be.  Unless it&#039;s for non-functional requirements, I&#039;m just not a fan of &quot;just-in-case&quot; development.</description>
		<content:encoded><![CDATA[<p>@Martin</p>
<p>Yep, it&#8217;s an assumption, but also the simplest thing that could possibly work.  I still don&#8217;t introduce duplication, that would be bad.  But I don&#8217;t really see the point of allowing this value to be configurable, when no one needs it to be.  Unless it&#8217;s for non-functional requirements, I&#8217;m just not a fan of &#8220;just-in-case&#8221; development.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Chandler</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2451</link>
		<dc:creator>Michael Chandler</dc:creator>
		<pubDate>Thu, 27 May 2010 12:07:40 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2451</guid>
		<description>@bogardj Code contracts allow for preconditions, postconditions and invariants. You /could/ use an invariant but they&#039;re checked at the /end/ of all public method calls, not the start. Besides, the constant isn&#039;t really a contract. 

I really like the idea of having the tests fail when the constant value is changed. It really makes you think and recognise what the implications for of making the change are.</description>
		<content:encoded><![CDATA[<p>@bogardj Code contracts allow for preconditions, postconditions and invariants. You /could/ use an invariant but they&#8217;re checked at the /end/ of all public method calls, not the start. Besides, the constant isn&#8217;t really a contract. </p>
<p>I really like the idea of having the tests fail when the constant value is changed. It really makes you think and recognise what the implications for of making the change are.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Evans</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2450</link>
		<dc:creator>Martin Evans</dc:creator>
		<pubDate>Thu, 27 May 2010 10:49:08 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2450</guid>
		<description>I suspect the biggest assumption you&#039;ve made is believing the customers original statement that the reward limit value has never changed and never needs to change!!

Perhaps my experience hasn&#039;t shaped my opinion enough to follow the JFHCI mantra at the moment but I&#039;d be a little nervous about setting that value to a constant.</description>
		<content:encoded><![CDATA[<p>I suspect the biggest assumption you&#8217;ve made is believing the customers original statement that the reward limit value has never changed and never needs to change!!</p>
<p>Perhaps my experience hasn&#8217;t shaped my opinion enough to follow the JFHCI mantra at the moment but I&#8217;d be a little nervous about setting that value to a constant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2449</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Thu, 27 May 2010 00:01:39 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2449</guid>
		<description>@Ryan

I thought code contracts were only for method parameters?  Here, it&#039;s just a hard-coded const, how would I use code contracts?

@Harry

That&#039;s pretty cool, I didn&#039;t know about that piece!  Thanks for the heads up!</description>
		<content:encoded><![CDATA[<p>@Ryan</p>
<p>I thought code contracts were only for method parameters?  Here, it&#8217;s just a hard-coded const, how would I use code contracts?</p>
<p>@Harry</p>
<p>That&#8217;s pretty cool, I didn&#8217;t know about that piece!  Thanks for the heads up!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harry Steinhilber</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2448</link>
		<dc:creator>Harry Steinhilber</dc:creator>
		<pubDate>Wed, 26 May 2010 22:09:54 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2448</guid>
		<description>I like to do the same thing for my tests, only using NUnit&#039;s Assume.That() instead of a Debug.Assert(). It allows all the tests to fail with an inconclusive result to show my assumptions are wrong, not the test.</description>
		<content:encoded><![CDATA[<p>I like to do the same thing for my tests, only using NUnit&#8217;s Assume.That() instead of a Debug.Assert(). It allows all the tests to fail with an inconclusive result to show my assumptions are wrong, not the test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Riley</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2447</link>
		<dc:creator>Ryan Riley</dc:creator>
		<pubDate>Wed, 26 May 2010 20:12:52 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2447</guid>
		<description>Have you considered Code Contracts? We&#039;re not using them (yet), but I&#039;ve also gotten pushback on using debug.assert instead of hard exceptions.</description>
		<content:encoded><![CDATA[<p>Have you considered Code Contracts? We&#8217;re not using them (yet), but I&#8217;ve also gotten pushback on using debug.assert instead of hard exceptions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2446</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Wed, 26 May 2010 18:06:24 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2446</guid>
		<description>@Darrell

Quite a few times I&#039;ll have calculations based on these constants, so I personally prefer not to duplicate the calculation logic to arrive at the expected result in my unit test.  Otherwise, no real harm, and probably just a preference thing.

@John

I go back and forth on this one, trying to figure out what best conveys the intent of the design.</description>
		<content:encoded><![CDATA[<p>@Darrell</p>
<p>Quite a few times I&#8217;ll have calculations based on these constants, so I personally prefer not to duplicate the calculation logic to arrive at the expected result in my unit test.  Otherwise, no real harm, and probably just a preference thing.</p>
<p>@John</p>
<p>I go back and forth on this one, trying to figure out what best conveys the intent of the design.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chadmyers</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2445</link>
		<dc:creator>chadmyers</dc:creator>
		<pubDate>Wed, 26 May 2010 14:43:56 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2445</guid>
		<description>I call these &quot;booby traps&quot;  If you change some fundamental assumption of the system, it should trigger a tripwire and smack you in the fact so you have to think about the consequences.

I like all my surprises up front and during development when I can deal with them properly vs. being surprised during a customer demo or live in production</description>
		<content:encoded><![CDATA[<p>I call these &#8220;booby traps&#8221;  If you change some fundamental assumption of the system, it should trigger a tripwire and smack you in the fact so you have to think about the consequences.</p>
<p>I like all my surprises up front and during development when I can deal with them properly vs. being surprised during a customer demo or live in production</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Bennett</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2444</link>
		<dc:creator>John Bennett</dc:creator>
		<pubDate>Wed, 26 May 2010 14:25:48 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2444</guid>
		<description>I like the JFHCI approach for this type of thing.  However, if the value is public I use &quot;static readonly&quot; instead of &quot;const&quot;.  That at least gives me the freedom to change the value in the future without having to recompile all the consuming assemblies that might have used it.</description>
		<content:encoded><![CDATA[<p>I like the JFHCI approach for this type of thing.  However, if the value is public I use &#8220;static readonly&#8221; instead of &#8220;const&#8221;.  That at least gives me the freedom to change the value in the future without having to recompile all the consuming assemblies that might have used it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darrell Mozingo</title>
		<link>http://lostechies.com/jimmybogard/2010/05/26/testing-assumptions-with-preconditions/#comment-2443</link>
		<dc:creator>Darrell Mozingo</dc:creator>
		<pubDate>Wed, 26 May 2010 14:17:20 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/05/26/testing-assumptions-with-preconditions.aspx#comment-2443</guid>
		<description>What would the downsides be to just using the constant in your tests, along the lines of result.ShouldEqual(Customer.GedgetSpendRewardLimit) rather than result.ShouldEqual(200m)? Then changing the constant&#039;s value wouldn&#039;t affect the tests.</description>
		<content:encoded><![CDATA[<p>What would the downsides be to just using the constant in your tests, along the lines of result.ShouldEqual(Customer.GedgetSpendRewardLimit) rather than result.ShouldEqual(200m)? Then changing the constant&#8217;s value wouldn&#8217;t affect the tests.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
