<?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/"
	>

<channel>
	<title>mattdavid.net &#187; Coding</title>
	<atom:link href="http://mattdavid.net/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattdavid.net</link>
	<description></description>
	<lastBuildDate>Wed, 24 Feb 2010 06:42:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Proof of concept, meet trashcan</title>
		<link>http://mattdavid.net/2010/02/24/proof-of-concept-meet-trashcan/</link>
		<comments>http://mattdavid.net/2010/02/24/proof-of-concept-meet-trashcan/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 04:51:13 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://mattdavid.net/?p=74</guid>
		<description><![CDATA[We&#8217;ve all done it. You start a proof-of-concept project to try to figure something out. Almost no planning or thought goes into it, you just dive right in. You finally get something working, but just barely. Now you&#8217;re in fix it mode. Hacking away at it, trying to salvage it, trying to mold it into [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmattdavid.net%2F2010%2F02%2F24%2Fproof-of-concept-meet-trashcan%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmattdavid.net%2F2010%2F02%2F24%2Fproof-of-concept-meet-trashcan%2F&amp;style=compact&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>We&#8217;ve all done it.  You start a proof-of-concept project to try to figure something out.  Almost no planning or thought goes into it, you just dive right in.  You finally get something working, but just barely.  Now you&#8217;re in fix it mode.  Hacking away at it, trying to salvage it, trying to mold it into something usable.</p>
<p>It&#8217;s not that bad, you say.  A little refactoring here, some more over there.  Patch this, whack that.  Oh wait, shouldn&#8217;t I be testing this?</p>
<p>I just went through this and caught myself before I went too far down this rabbit hole.</p>
<p>The idea is a digital picture frame app for the iphone using images from Facebook.  Sure, there are apps that already do this, but I wanted some exposure to the Facebook api.  I also wanted to do a relatively small iphone app before I dive into some of my other ideas for projects.</p>
<p>It was going along pretty well.  I wrote some code to pull down pictures from Facebook.  I had some code that cycled through the pictures.  Then I started trying to shove more feature into it.  I definitely need some settings, right?  Where will the Facebook connect button go?  I&#8217;ll definitely need some background threads!</p>
<p>As I started on my third pass of refactorings, I realized what I was doing&#8230;poor code didn&#8217;t know what hit it.</p>
<p>Now, taking the lessons learned and some code snippets (for reference), it&#8217;s time to toss the proof of concept into the trash bin.  It&#8217;s where it belongs.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdavid.net/2010/02/24/proof-of-concept-meet-trashcan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two birds with one stone</title>
		<link>http://mattdavid.net/2009/04/30/two-birds-with-one-stone/</link>
		<comments>http://mattdavid.net/2009/04/30/two-birds-with-one-stone/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 05:54:52 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://mattdavid.net/2009/04/30/two-birds-with-one-stone/</guid>
		<description><![CDATA[As some may or may not have heard, I started freelancing on the side.&#160; My first side project is pretty interesting ( was interesting if your reading this in the distant future.)&#160; Basically, the project was to talk to different devices and provide status information back from the devices through an LCD panel. Pretty straightforward.&#160; [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmattdavid.net%2F2009%2F04%2F30%2Ftwo-birds-with-one-stone%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmattdavid.net%2F2009%2F04%2F30%2Ftwo-birds-with-one-stone%2F&amp;style=compact&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>As some may or may not have heard, I started freelancing on the side.&#160; My first side project is pretty interesting ( was interesting if your reading this in the distant future.)&#160; Basically, the project was to talk to different devices and provide status information back from the devices through an LCD panel.</p>
<p>Pretty straightforward.&#160; Oh wait, it has to run on an <a href="http://www.via.com.tw/en/products/mainboards/">EPIA platform</a>.&#160; Also, Windows XP isn’t a viable option… </p>
<p>Hello Linux and <a href="http://www.mono-project.com/Main_Page">Mono</a>!&#160; Did I mention that my preferred language is C#?&#160; I’m not a fan of writing C or C++ since I drank the .Net Kool-Aid back in 2003.</p>
<p>Surprisingly, my development platform of choice (Vista and VS 2008) and the target platform (Linux + Mono) work out well.&#160; Really the only hiccups I’ve encountered have been with the project files and NUnit.&#160; If I create a test project in VS2008 and open it with MonoDevelop (on the Linux development machine), it can’t seem to locate that NUnit assemblies, but after I correct it in MonoDevelop, VS2008 doesn’t have a problem with it.</p>
<p>Maybe it’s just me, but the ability to run the same code on two different platforms makes me happy.&#160; And it’s crazy easy to run a Mono development environment.&#160; Just download VMware&#8217;s <a href="http://www.vmware.com/products/player/">player</a>, download the <a href="http://www.go-mono.com/mono-downloads/download.html">virtual machine</a> for the Mono development environment and run&#8230;it rocks.!</p>
<p>Actually, I fibbed just a bit…there’s been one other issue with Mono that kind of annoys me.&#160; It’s with the implementation of the SerialPort class.&#160; Basically, the SerialPort class has <a href="http://mono-project.com/HowToSystemIOPorts">no notification for received serial data</a>.&#160; It’s pretty easy to work around this (it involves polling the SerialPort and works on Windows just as well), but it is a pain point.</p>
<p>So, if you find yourself needing to do cross platform development in .Net, check out Mono.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdavid.net/2009/04/30/two-birds-with-one-stone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Git And You</title>
		<link>http://mattdavid.net/2009/01/20/git-and-you/</link>
		<comments>http://mattdavid.net/2009/01/20/git-and-you/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 05:01:08 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Version Control]]></category>

		<guid isPermaLink="false">http://mattdavid.net/2009/01/20/git-and-you/</guid>
		<description><![CDATA[Git is the new hotness.  There are other distributed version control systems, but git seems to be the one that&#8217;s taken off the most from what I&#8217;ve seen.  There&#8217;s Mercurial (the command &#8220;hg&#8221; is pretty sweet) or Bazaar (does anyone use this?), but it seems that most all of the projects I&#8217;m interested in that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmattdavid.net%2F2009%2F01%2F20%2Fgit-and-you%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmattdavid.net%2F2009%2F01%2F20%2Fgit-and-you%2F&amp;style=compact&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Git is the new hotness.  There are other <a href="http://en.wikipedia.org/wiki/Distributed_revision_control">distributed version control systems</a>, but git seems to be the one that&#8217;s taken off the most from what I&#8217;ve seen.  There&#8217;s Mercurial (the command &#8220;hg&#8221; is pretty sweet) or Bazaar (does anyone use this?), but it seems that most all of the projects I&#8217;m interested in that use dvcs are using git (I&#8217;m looking at you <a href="http://www.ironruby.net/">IronRuby</a>.)</p>
<p>Git may be a bit confusing when you first start working with it, but fortunately, <a title="http://gitready.com/" href="http://gitready.com/">http://gitready.com/</a> has a bunch of tips for dealing with git day to day.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdavid.net/2009/01/20/git-and-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TDD Is About Design, Not Testing</title>
		<link>http://mattdavid.net/2009/01/20/tdd-is-about-design-not-testing/</link>
		<comments>http://mattdavid.net/2009/01/20/tdd-is-about-design-not-testing/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 04:19:06 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://mattdavid.net/2009/01/20/tdd-is-about-design-not-testing/</guid>
		<description><![CDATA[I was recently reminded of this by Scott Bellware on this hanselminutes episode. It&#8217;s easy to fall into the trap of thinking about TDD as a testing technique.  I mean, Test is the first word in TDD.  And normally you hear it talked about as Test Driven Development, not Test Driven Design.  Since most development [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmattdavid.net%2F2009%2F01%2F20%2Ftdd-is-about-design-not-testing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmattdavid.net%2F2009%2F01%2F20%2Ftdd-is-about-design-not-testing%2F&amp;style=compact&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I was recently reminded of this by <a href="http://blog.scottbellware.com/">Scott Bellware</a> on <a href="http://www.hanselman.com/blog/HanselminutesPodcast146TestDrivenDevelopmentIsDesignTheLastWordOnTDD.aspx">this hanselminutes episode</a>.</p>
<p>It&#8217;s easy to fall into the trap of thinking about TDD as a testing technique.  I mean, Test <em>is</em> the first word in TDD.  And normally you hear it talked about as <strong>T</strong>est <strong>D</strong>riven <strong>D</strong>evelopment, not <strong>T</strong>est <strong>D</strong>riven <strong>D</strong>esign.  Since most development going on is probably not <a href="http://en.wikipedia.org/wiki/Greenfield_project">Greenfield</a>, but is in maintenance/support mode, I&#8217;d bet that those involved with most applications think that the design phase is &#8220;done&#8221;.  Even when new features are being added to an existing application/platform, it&#8217;s not like you&#8217;re starting from scratch, you&#8217;re usually bolting things on to existing functionality.</p>
<p>And therein lies a pitfall.  Most people would probably be more concerned with not breaking existing functionality, as opposed to letting TDD help design the new functionality.</p>
<p>Another pitfall comes from that first word, Test.  Don&#8217;t get me wrong, I love tests.  However, it is quite possible that you follow the <a href="http://en.wikipedia.org/wiki/Test-driven_development#Test-Driven_Development_Cycle">red/green/refactor</a> methodology of writing tests and still come out with poorly designed code. This comes from what I like to call the &#8220;Mother of Invention Principle&#8221;.  Yeah, I just coined a principle.  Basically, one of the ideas of TDD is that there should be no new code added until it is required by at least one test.  So, if you follow this principle, then you should technically have 100% code coverage when finished.</p>
<p>Unfortunately, 100% code coverage isn&#8217;t useful.  Anything but 100% would be useful (but more on that in another post.)  Maybe the tests were poorly designed.  Maybe the tests are spot on, but they require huge amounts of setup and teardown for each test.  Sure, it&#8217;s tested, but is it designed well?</p>
<p>This kind of thinking, about &#8220;fully&#8221; tested code, sure make TDD a good sell to management and QA, but alas, that&#8217;s not what TDD was meant for.</p>
<p>Anyway, I won&#8217;t belabor the point, listen to the podcast.  Scott and Scott talk about this much more eloquently than I can.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdavid.net/2009/01/20/tdd-is-about-design-not-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spectacle</title>
		<link>http://mattdavid.net/2008/12/14/spectacle/</link>
		<comments>http://mattdavid.net/2008/12/14/spectacle/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 16:40:43 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Spectacle]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://mattdavid.net/2008/12/14/spectacle/</guid>
		<description><![CDATA[I&#8217;ve don&#8217;t like writing unit tests, plain and simple.  Do I write test code?  Absolutely.  I think not writing tests will set you up for a truckload of fail. What I don&#8217;t like about writing the tests is the seemingly foreign language that their written in.  Sure it might be C# or VB, but it [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmattdavid.net%2F2008%2F12%2F14%2Fspectacle%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmattdavid.net%2F2008%2F12%2F14%2Fspectacle%2F&amp;style=compact&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;ve don&#8217;t like writing unit tests, plain and simple.  Do I write test code?  Absolutely.  I think not writing tests will set you up for a truckload of fail.</p>
<p>What I don&#8217;t like about writing the tests is the seemingly foreign language that their written in.  Sure it might be C# or VB, but it looks drastically different from the object oriented code we write on a daily basis.</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060;">   1:</span> MyClass superGuy = <span style="color: #0000ff;">new</span> MyClass();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060;">   2:</span> <span style="color: #0000ff;">string</span> result = superGuy.GetResult();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060;">   3:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060;">   4:</span> Assert.AreEqual(<span style="color: #006080;">"good result"</span>, result);</pre>
</div>
</div>
<p>I just don&#8217;t think that way.  For one, I can&#8217;t just look at that line and know what&#8217;s being tested without having to read through the entire line, Two, it takes me a few seconds to mentally adjust to thinking about the code that way.  Finally, I have a tendency to swap the expected and actual when writing out the asserts which confuses me when the assertion fails.</p>
<p>Wouldn&#8217;t it be nice to be able to write:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060;">   1:</span> MyClass superGuy = <span style="color: #0000ff;">new</span> MyClass();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060;">   2:</span> <span style="color: #0000ff;">string</span> result = superGuy.GetResult();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060;">   3:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060;">   4:</span> result.IsNotNull();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060;">   5:</span> result.IsEqualTo(<span style="color: #006080;">"good result"</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060;">   6:</span> <span style="color: #008000;">// or combine them</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060;">   7:</span> result.IsNotNull().And.IsEqualTo(<span style="color: #006080;">"good result"</span>);</pre>
</div>
</div>
<p>That&#8217;s what <a href="http://www.github.com/mattdavid/spectacle/tree/master">spectacle</a> is all about.  It&#8217;s a collection of extension methods to ease the pain when writing unit tests.  It only targets MbUnit v2 right now, because that&#8217;s what I&#8217;m currently using.</p>
<p>If you want to try it out, clone it from the github repository and build it.  Next all you&#8217;ll need to do is add a reference to your test project  and add a &#8220;using Spectacle.MbUnitAssertions;&#8221; to your code files.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdavid.net/2008/12/14/spectacle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
