<?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: Coding: API readability/testability</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 31 Jul 2010 12:46:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Jonathan</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23787</link>
		<dc:creator>Jonathan</dc:creator>
		<pubDate>Sat, 10 Oct 2009 02:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23787</guid>
		<description>@Ryan -- I just blogged about your particular solution for controlling &quot;now&quot;.  What does the &quot;HasBeen&quot; method do in your above example.  Also, do you have any other interesting behavior/methods on your DomainTime instance?</description>
		<content:encoded><![CDATA[<p>@Ryan &#8212; I just blogged about your particular solution for controlling "now".  What does the "HasBeen" method do in your above example.  Also, do you have any other interesting behavior/methods on your DomainTime instance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23784</link>
		<dc:creator>Jonathan</dc:creator>
		<pubDate>Sat, 10 Oct 2009 02:39:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23784</guid>
		<description>We use something similar to Ryan&#039;s approach, but based upon the code he&#039;s got, I think I like his solution better.  It&#039;s simply, elegant, testable, and doesn&#039;t require injection into your entity objects.</description>
		<content:encoded><![CDATA[<p>We use something similar to Ryan's approach, but based upon the code he's got, I think I like his solution better.  It's simply, elegant, testable, and doesn't require injection into your entity objects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Cleveland</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23730</link>
		<dc:creator>Phil Cleveland</dc:creator>
		<pubDate>Fri, 09 Oct 2009 17:32:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23730</guid>
		<description>What about making the the test method (CreateForSomeSituationForTest) internal, so that the API will not be polluted? Of course you would have to setup your test fixture to have access to internal methods with this approach.</description>
		<content:encoded><![CDATA[<p>What about making the the test method (CreateForSomeSituationForTest) internal, so that the API will not be polluted? Of course you would have to setup your test fixture to have access to internal methods with this approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Coding: API readability/testability at Mark Needham -- Topsy.com</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23721</link>
		<dc:creator>Tweets that mention Coding: API readability/testability at Mark Needham -- Topsy.com</dc:creator>
		<pubDate>Fri, 09 Oct 2009 15:46:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23721</guid>
		<description>[...] This post was mentioned on Twitter by planettw. planettw said: Mark Needham: Coding: API readability/testability: About a month ago or so I described how we did some work to .. http://bit.ly/59xkr [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by planettw. planettw said: Mark Needham: Coding: API readability/testability: About a month ago or so I described how we did some work to .. <a href="http://bit.ly/59xkr" rel="nofollow">http://bit.ly/59xkr</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Roberts</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23713</link>
		<dc:creator>Ryan Roberts</dc:creator>
		<pubDate>Fri, 09 Oct 2009 15:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23713</guid>
		<description>Yes, unfortunately. It&#039;s not a real proxy. A clock object would be more elegant, but then you get into issues around service injection into domain objects. An issue I blithely ignored by using a static dependency  :)</description>
		<content:encoded><![CDATA[<p>Yes, unfortunately. It's not a real proxy. A clock object would be more elegant, but then you get into issues around service injection into domain objects. An issue I blithely ignored by using a static dependency  <img src='http://www.markhneedham.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23711</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Fri, 09 Oct 2009 14:48:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23711</guid>
		<description>@Adam - that was the other thing we were debating - forgot to mention that! Thinking was maybe a clock was a bit overkill at the moment because we only have this one test which is dependent on date. In general though I like the idea of the clock. 

@Ryan - so do you use &#039;DomainTime&#039; in your code instead of &#039;DateTime&#039; with that approach?</description>
		<content:encoded><![CDATA[<p>@Adam &#8211; that was the other thing we were debating &#8211; forgot to mention that! Thinking was maybe a clock was a bit overkill at the moment because we only have this one test which is dependent on date. In general though I like the idea of the clock. </p>
<p>@Ryan &#8211; so do you use 'DomainTime' in your code instead of 'DateTime' with that approach?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Roberts</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23710</link>
		<dc:creator>Ryan Roberts</dc:creator>
		<pubDate>Fri, 09 Oct 2009 14:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23710</guid>
		<description>I use a ..static DomainTime.Instance shim to control datetime in tests.

Ends up with something like

using(DomainTime.Is(new(DateTime(2003,10,10))
{
   var model = SomeRandomModel.JustTheUsualMethod();
   DomainTime.HasBeen(new TimeSpan(0,0,0,1));
   
   Assert.AreEqual(..) 
}

Where the using scope controls whether the DomainTime class returns real times or test values.</description>
		<content:encoded><![CDATA[<p>I use a ..static DomainTime.Instance shim to control datetime in tests.</p>
<p>Ends up with something like</p>
<p>using(DomainTime.Is(new(DateTime(2003,10,10))<br />
{<br />
   var model = SomeRandomModel.JustTheUsualMethod();<br />
   DomainTime.HasBeen(new TimeSpan(0,0,0,1));</p>
<p>   Assert.AreEqual(..)<br />
}</p>
<p>Where the using scope controls whether the DomainTime class returns real times or test values.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Scott</title>
		<link>http://www.markhneedham.com/blog/2009/10/10/coding-api-readabilitytestability/comment-page-1/#comment-23709</link>
		<dc:creator>Adam Scott</dc:creator>
		<pubDate>Fri, 09 Oct 2009 14:40:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1713#comment-23709</guid>
		<description>The alternative is to stub what DateTime.Today returns. However I realise that stubbing static calls is not trivial, so I guess the question becomes - how about injecting a Clock object, rather than relying on the static call?</description>
		<content:encoded><![CDATA[<p>The alternative is to stub what DateTime.Today returns. However I realise that stubbing static calls is not trivial, so I guess the question becomes &#8211; how about injecting a Clock object, rather than relying on the static call?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
