<?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>FatLemon &#187; Development</title>
	<atom:link href="http://www.fatlemon.co.uk/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fatlemon.co.uk</link>
	<description>Contemplations on software development and human factors, by Andrew Freemantle</description>
	<lastBuildDate>Sun, 29 Jan 2012 13:45:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WTV: Automatic date-based version numbering for .Net with WhenTheVersion</title>
		<link>http://www.fatlemon.co.uk/2011/11/wtv-automatic-date-based-version-numbering-for-net-with-whentheversion/</link>
		<comments>http://www.fatlemon.co.uk/2011/11/wtv-automatic-date-based-version-numbering-for-net-with-whentheversion/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 22:00:12 +0000</pubDate>
		<dc:creator>Andrew Freemantle</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SubVersion]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WTV]]></category>

		<guid isPermaLink="false">http://www.fatlemon.co.uk/?p=101</guid>
		<description><![CDATA[There&#8217;s a trend towards using the software build date as part of the software version number, you know the sort of thing I mean: &#8216;2011.11.4.xyz&#8216;, like in the footer over at StackOverflow.com, or MyLetts.com.. Wouldn&#8217;t it be great if we could get Visual Studio to do this for us automatically on build?  I thought so [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a trend towards using the software build date as part of the software version number, you know the sort of thing I mean: &#8216;<span class="inline-code">2011.11.4.xyz</span>&#8216;, like in the footer over at <a title="StackOverflow.com - Q&amp;A for Programmers" href="http://www.stackoverflow.com">StackOverflow.com</a>, or <a title="MyLetts.com - Lettings management for private landlords" href="http://www.myletts.com">MyLetts.com</a>..</p>
<p><a href="http://www.fatlemon.co.uk/wp-content/uploads/wtv-date-version-example-myletts-com1.png"><img class="alignnone size-full wp-image-214" title="WTV Date-version example: www.MyLetts.com" src="http://www.fatlemon.co.uk/wp-content/uploads/wtv-date-version-example-myletts-com1.png" alt="" width="337" height="113" /></a></p>
<p>Wouldn&#8217;t it be great if we could get Visual Studio to do this for us automatically on build?  I thought so too, so I&#8217;ve written a little app to do it <img src='http://www.fatlemon.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Getting set up with &#8220;When The Version&#8221;</h4>
<ol>
<li>Go get a copy of &#8220;When The Version&#8221; (<span class="inline-code">WTV.exe</span>) from <a title="WhenTheVersion - Download page at GitHub" href="https://github.com/AndrewFreemantle/When-The-Version/downloads">the GitHub download page</a> (or you can <a title="When The Version - Source on GitHub" href="https://github.com/AndrewFreemantle/When-The-Version">build it from the source</a> if you prefer)</li>
<li>Drop it somewhere on your PC</li>
<li>Now, in your Visual Studio project, expand the Properties and duplicate the <span class="inline-code">AssemblyInfo.cs</span> / <span class="inline-code">.vb</span> file &#8211; I rename the duplicate to be <span class="inline-code">AssemblyInfo.Template.cs</span>:</li>
</ol>
<p><a href="http://www.fatlemon.co.uk/wp-content/uploads/wtv-date-version-solution-explorer.png"><img class="size-full wp-image-212 alignnone" title="AssemblyInfo.Template.cs - Solution Explorer" src="http://www.fatlemon.co.uk/wp-content/uploads/wtv-date-version-solution-explorer.png" alt="" width="288" height="148" /></a></p>
<ol start="4">
<li>Edit the <span class="inline-code">AssemblyInfo.Template.cs</span> file, putting in the placeholders for the date parts like so:</li>
</ol>
<pre>

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("{YYYY}.{MM}.{DD}.0")]
[assembly: AssemblyFileVersion("{YYYY}.{MM}.{DD}.0")]
</pre>
<p>The following values are currently supported:</p>
<ul>
<li><span class="inline-code">{YYYY}</span> &#8211; the year</li>
<li><span class="inline-code">{MM}</span> &#8211; the month</li>
<li><span class="inline-code">{DD}</span> &#8211; the day</li>
<li><span class="inline-code">{SVN}</span> &#8211; SubVersion revision number (more on this a bit later)</li>
</ul>
<p>&nbsp;</p>
<ol start="5">
<li>Now, open up the Project Properties &gt; Build Events, and add the following Pre-build event command line (on a single line):</li>
</ol>
<pre>

"C:\Path\To\wtv.exe"
  "$(ProjectDir)Properties\AssemblyInfo.Template.cs"
  "$(ProjectDir)Properties\AssemblyInfo.cs"
</pre>
<p>&nbsp;</p>
<ol start="6">
<li>Finally, set the Build Action for the new <span class="inline-code">AssemblyInfo.Template.cs</span> file to &#8216;None&#8217; and Build!</li>
</ol>
<p>&nbsp;</p>
<p>If you get stuck, pop open a Command Prompt and run <span class="inline-code">WTV.exe</span> without any parameters:</p>
<p><a href="http://www.fatlemon.co.uk/wp-content/uploads/wtv-date-version-command-prompt-usage1.png"><img class="alignnone size-full wp-image-223" title="WTV: Command prompt usage" src="http://www.fatlemon.co.uk/wp-content/uploads/wtv-date-version-command-prompt-usage1.png" alt="" width="632" height="342" /></a></p>
<h4>SubVersion support</h4>
<p>If you&#8217;re using SubVersion for your source control, <span class="inline-code">WTV</span> can also put the projects SVN revision number into the application version.</p>
<p><em><strong>There&#8217;s only one caveat</strong></em> &#8211; .Net Application version number values are limited to a maximum of 32,767 (i.e. they&#8217;re Int16&#8242;s). Therefore, if your SVN revision is higher <span class="inline-code">WTV</span> will only use the last 4 digits: e.g.: 32768 -&gt; 2768.</p>
<p>To use the SVN revision number, simply add the <span class="inline-code">{SVN}</span> placeholder to your <span class="inline-code">AssemblyInfo.Template.cs</span> file like so:</p>
<pre>

[assembly: AssemblyVersion("{YYYY}.{MM}.{DD}.{SVN}")]
[assembly: AssemblyFileVersion("{YYYY}.{MM}.{DD}.{SVN}")]
</pre>
<p>&nbsp;</p>
<p>.. and then add a couple of extra parameters to the Pre-build event command line so <span class="inline-code">WTV</span> knows where <span class="inline-code">SubWCRev.exe</span> is, something like this (again, on a single line):</p>
<pre>

"C:\Path\To\WTV.exe"
  "$(ProjectDir)Properties\AssemblyInfo.Template.cs"
  "$(ProjectDir)Properties\AssemblyInfo.cs"
  "C:\Program Files\TortoiseSVN\bin\SubWCRev.exe"
  "$(SolutionDir)."
</pre>
<p>&nbsp;<br />
And because the <span class="inline-code">AssemblyInfo.cs</span> is generated, you can remove it from source control (but don&#8217;t remove it from your project!)</p>
<p>&nbsp;</p>
<h4>Finally</h4>
<p>Comments and suggestions are welcome here or on the <a title="WhenTheVersion - Issue tracker at GitHub" href="https://github.com/AndrewFreemantle/When-The-Version/issues">projects issue tracker over at GitHub</a>. I hope you find it useful  <img src='http://www.fatlemon.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><script src="/wp-content/syntax-highlighter/Scripts/shCore.js"></script> <script src="/wp-content/syntax-highlighter/Scripts/shBrushVb.js"></script></p>
<p><script type="text/javascript">// <![CDATA[
  dp.SyntaxHighlighter.ClipboardSwf = '/wp-content/syntax-highlighter/Scripts/clipboard.swf'; dp.SyntaxHighlighter.HighlightAll('code');
// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fatlemon.co.uk/2011/11/wtv-automatic-date-based-version-numbering-for-net-with-whentheversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why are software developers so bad at estimating time?</title>
		<link>http://www.fatlemon.co.uk/2009/01/why-are-software-developers-so-bad-at-estimating-time/</link>
		<comments>http://www.fatlemon.co.uk/2009/01/why-are-software-developers-so-bad-at-estimating-time/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 15:00:26 +0000</pubDate>
		<dc:creator>Andrew Freemantle</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Estimating]]></category>
		<category><![CDATA[Productivity]]></category>

		<guid isPermaLink="false">http://www.fatlemon.co.uk/?p=23</guid>
		<description><![CDATA[In order to answer this question, we need to understand the term &#8220;flow&#8221;. From Peopleware: During single-minded work time, people are ideally in a state that psychologists call flow. Flow is a condition of deep, nearly meditative involvement. In this state, there is a gentle sense of euphoria, and one is largely unaware of the [...]]]></description>
			<content:encoded><![CDATA[<p>In order to answer this question, we need to understand the term &#8220;flow&#8221;. From <a title="Peopleware: Productive People and Teams - Amazon.co.uk" href="http://www.amazon.co.uk/gp/product/0932633439?ie=UTF8&amp;tag=fatl-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0932633439">Peopleware</a>:</p>
<blockquote><p>During single-minded work time, people are ideally in a state that psychologists call <em>flow</em>. Flow is a condition of deep, nearly meditative involvement. In this state, there is a gentle sense of euphoria, and one is largely unaware of the passage of time: &#8220;I began to work. I looked up, and three hours had passed.&#8221;  There is no consciousness of effort; the work just seems to, well, flow. You&#8217;ve been in this state often, so we don&#8217;t have to describe it to you.</p>
<p>Not all work roles require that you attain a state of flow in order to be productive, but for anyone involved in engineering, design, development, writing, or like tasks, flow is a must. These are high-momentum tasks. It&#8217;s only when you&#8217;re in flow that the work goes well.</p></blockquote>
<p>To paraphrase, &#8220;It&#8217;s only when you&#8217;re in flow that you&#8217;re at your most productive&#8221;.</p>
<p>The quotation is taken from chapter 10, page 65. I know that because after reading those short paragraphs, I realised something that made me stop and put the book down..</p>
<p><strong>When a software developer thinks up an estimated time to complete a development task &#8211; they&#8217;re thinking solely in &#8220;flow&#8221; time.</strong></p>
<p>That realisation is profound.</p>
<p>Sure, more experienced software developers will <em>then</em> add time to this based on their experience before giving their answer, but their first thought is based on <em>flow-time</em>, which is their best-case, uninterrupted development time.</p>
<p><strong>Why is this?</strong></p>
<p>I think it&#8217;s a combination of 2 things;</p>
<ol>
<li>The question itself.. &#8220;how long would it take you to do / fix / add / change x?&#8221;.<br />
A developers starting point is their experience of development to date, and that development is at it&#8217;s most productive in flow-time. So they&#8217;re going to answer you based on them being in productive flow-time. However, this means they&#8217;re starting their estimate based on an unaware assumption that they&#8217;re quoting flow-time.<br />
For example, if a developer responds with &#8220;it&#8217;ll take me half a day&#8221;, what they&#8217;re really saying is &#8220;with a half-day of flow-time, I can do / fix /add / change x&#8221;.</li>
<li>If you didn&#8217;t already know, <a title="Defeating optimism - CodingHorror.com" href="http://www.codinghorror.com/blog/archives/000284.html">developers are optimistic</a>. They&#8217;re optimistic about how much they can get done, and they&#8217;re optimistic about how much flow-time they&#8217;re going to have.</li>
</ol>
<p><strong>So what is the answer?!</strong></p>
<p>To quote more from <a title="Peopleware: Productive People and Teams - Amazon.co.uk" href="http://www.amazon.co.uk/gp/product/0932633439?ie=UTF8&amp;tag=fatl-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0932633439">Peopleware</a>:</p>
<blockquote><p>Chances are, your company&#8217;s present time accounting system is based on a conventional model. It assumes that work accomplished is proportional to the number of hours put in. When workers fill out their time sheets in this scheme, they make no distinction between doing meaningful work and hours of pure frustration. So they&#8217;re reporting body time rather than brain time.</p>
<p>&#8230;</p>
<p>The phenomena of flow and immersion give us a more realistic way to model how time is applied to a development task. What matters is not the amount of time you&#8217;re <em>present</em>, but the amount of time that you&#8217;re <em>working at full potential</em>. An hour in flow really accomplishes something, but ten six-minute work periods sandwiched between eleven interruptions won&#8217;t accomplish anything.</p></blockquote>
<p>The answer, then, is to take the developers estimate with a pinch of salt (the more &#8216;seasoned&#8217; the developer, the less salt required), remember that their estimate <strong>is an <a title="Estimate (noun): an approximate judgment or calculation - dictionary.com" href="http://dictionary.reference.com/browse/estimate"><em>estimate</em></a></strong>, and use it with <a title="Evidence Based Scheduling - JoelOnSoftware.com" href="http://www.joelonsoftware.com/items/2007/10/26.html">evidence based scheduling</a> (if you aren&#8217;t already).</p>
<p>The next question you may be asking of course, is how do I reduce the difference between the estimate and the actual &#8211; the &#8216;slip&#8217;.</p>
<p>That&#8217;s a topic for another day. I&#8217;ll let you know when I&#8217;ve finished <a title="Peopleware: Productive People and Teams - Amazon.co.uk" href="http://www.amazon.co.uk/gp/product/0932633439?ie=UTF8&amp;tag=fatl-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0932633439">Peopleware</a>, or you can grab a copy for yourself  <img src='http://www.fatlemon.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.fatlemon.co.uk/2009/01/why-are-software-developers-so-bad-at-estimating-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reply to Iain Arthurs &#8211; Software Development Course Content</title>
		<link>http://www.fatlemon.co.uk/2008/07/reply-to-iain-arthurs-software-development-course-content/</link>
		<comments>http://www.fatlemon.co.uk/2008/07/reply-to-iain-arthurs-software-development-course-content/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 09:00:56 +0000</pubDate>
		<dc:creator>Andrew Freemantle</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.fatlemon.co.uk/?p=14</guid>
		<description><![CDATA[Recently, our little software company was contacted by a local college, to provide feedback on the content of a couple of new software engineering and advanced programming courses they are looking to run. I saw this is my first opportunity to offer my assistance to those asking how should we teach software engineering? Hi Iain, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, <a href="http://www.onepointsystems.com/" title="OnePoint Systems Ltd" target="_blank">our little software company</a> was contacted by a <a href="http://www.gateshead.ac.uk/" title="Gateshead College" target="_blank">local college</a>, to provide feedback on the content of a couple of new software engineering and advanced programming courses they are looking to run.</p>
<p><img src="/images/532895938_3581d6f105_m.jpg" height="180" width="240" /></p>
<p>I saw this is my first opportunity to offer my assistance to those asking <a href="http://www.codinghorror.com/blog/archives/001035.html" title="Coding Horror - How should we teach Software Engineering?" target="_blank">how should we teach software engineering?</a></p>
<blockquote><p> Hi Iain, thank you for your reminder &#8211; please accept my apologies for not getting back to you sooner!</p>
<p>I&#8217;ve read the 2 course outlines you sent and I think you&#8217;ve got a good focus for students wishing to go on to develop software development roles. I like the outline of the courses very much &#8211; especially your choice of .Net as we&#8217;re a .Net-based development company ourselves.</p>
<p>If I may, I would like to suggest a few areas that I found lacking in my own formal education that I think, should a graduate make note of on their C.V. as having had experience of on your courses, would put them on top of the pile based on my experience of hiring developers at OnePoint Systems. These are, namely:</p>
<p><u>An introduction to source control</u><br />
this could be as little as a single session describing what it is, why it&#8217;s essential in software development, release and maintenance lifecycles &#8211; without a doubt in team-based development, but it can also offer huge benefits for individuation development projects. I think it would be ideal to get the students to have hands-one experience with it &#8211; say as part of a team project, or as a requirement for handing in software for marking that it is checked in to some source control that the teacher would then check-out and build so as to mark</p>
<p><u>An overview of Agile Methodologies</u><br />
I see you have R.A.D. and Prototyping listed which is excellent (as is understanding the Waterfall Lifecycle), but I&#8217;ve found in my professional development that Agile &#8211; specifically Test-Driven Development (TDD) is fast becoming commonplace in software development companies &#8211; to quote Steve McConnell (author of Code Complete): &#8220;within the next few years we won’t talk about Agile much anymore; we’ll just talk about programming&#8221;. I would not wish to cover this topic in any more detail as I assume you are already familiar with it</p>
<p><u>A lesson on 3rd party tools and controls</u><br />
Something that I found completely missing in my formal education was (even the notion of) the practice of using 3rd party tools and controls within my own software projects. While tools could be covered by introducing source-control and add-ins for development IDE&#8217;s (such as Microsoft&#8217;s SourceSafe or Team System), or debugging tools such as Lutz Roeder&#8217;s .Net Reflector, the integration of 3rd party controls for their re-use value alone is, in my opinion, worth a session on its own &#8211; even if the students don&#8217;t get to actually use 3rd part controls. I&#8217;m thinking of listing a few resources such as ComponentSource.com, telerik.com, infragistics.com or janussys.com &#8211; to open the students mind to the idea that developing everything in-house is rarely the best way to proceed.</p>
<p><u> Reporting</u><br />
for most application development a little hands-on experience about how software reports are put together is, again, in my opinion essential. The reporting engine, be it Microsoft Reporting Services, Crystal Reports or a 3rd party reporting add-in such as Active Reports for .Net is of little differentiating factor for the simple kind of reports that allow the students to get the data out of their software creations and onto a physical piece of paper. In many ways, I think report creation is the final, completing step in creating a software application &#8211; it&#8217;s the tangible output of an intangible product.</p>
<p>I thank you very much for this opportunity to offer my feedback, and I wish you and your students the very best.  If I may be of any further assistance, please get in touch and I shall endeavour to be a little more responsive with my reply.</p>
<p>Kindest regards,</p>
<p>Andrew<br />
&#8211;<br />
Andrew Freemantle</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.fatlemon.co.uk/2008/07/reply-to-iain-arthurs-software-development-course-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How far should your unit tests go?</title>
		<link>http://www.fatlemon.co.uk/2008/02/how-far-should-your-unit-tests-go/</link>
		<comments>http://www.fatlemon.co.uk/2008/02/how-far-should-your-unit-tests-go/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 18:00:31 +0000</pubDate>
		<dc:creator>Andrew Freemantle</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://www.fatlemon.co.uk/?p=9</guid>
		<description><![CDATA[I don&#8217;t think it would be appropriate to talk about Unit Testing without first starting with the bigger picture of Agile Software Engineering Methodologies. I started working to the Agile methodologies, as described by Robert C. Martin about 18 months ago. It was hard not to see it as a &#8216;magic bullet&#8217; that enables the [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t think it would be appropriate to talk about Unit Testing without first starting with the bigger picture of Agile Software Engineering Methodologies.</p>
<p>I started working to the Agile methodologies, as described by <a title="Amazon Books: Robert C. Martin - Agile Software Development: Principles, Patterns and Practices" href="http://www.amazon.co.uk/Software-Development-Principles-Patterns-Practices/dp/0135974445/ref=pd_bbs_sr_1?ie=UTF8&amp;s=gateway&amp;qid=1202639026&amp;sr=8-1" target="_blank">Robert C. Martin</a> about 18 months ago. It was hard not to see it as a &#8216;magic bullet&#8217; that enables the production of quality software because it just made so much sense to me.  Here&#8217;s <a title="5 Questions on Agile Development - 10x Software Development" href="http://forums.construx.com/blogs/stevemcc/archive/2007/10/08/5-questions-on-agile-development.aspx" target="_blank">Steve McConnell&#8217;s view of Agile development</a>:</p>
<blockquote><p><strong>Q4: What is the future of Agile?<br />
</strong>Agile has largely become a synonym for &#8220;modern software practices that work,&#8221; so I think the future of Agile with a capital &#8220;A&#8221; is the same as the past of Object Oriented or Structured. We rarely talk about Object Oriented programming anymore; it&#8217;s just programming. Similarly, I think Agile has worked its way into the mainstream such that <strong>within the next few years we won&#8217;t talk about Agile much anymore; we&#8217;ll just talk about programming</strong>, and it will be assumed that everyone means Agile whenever that&#8217;s appropriate.</p></blockquote>
<p>I have emphasised Steve&#8217;s sentence that beautifully sums up Agile for me &#8211; &#8216;Agile&#8217; is my definition of programming.</p>
<p>Changing my way of thinking from initially &#8216;where do I start coding the solution?&#8217; to &#8216;how am I going to TEST the solution?&#8217; was definitely challenging, but I still remember sitting down to start actually writing test code and wondering &#8216;how far should my unit tests go?&#8217; &#8211; meaning, if I&#8217;m testing that an Object can persist, or save its state to a database, how do I test that it&#8217;s working?</p>
<p>My current project incorporates the excellent <a title="Component-based, Scalable Logical Architecture (CSLA) - Homepage" href="http://www.lhotka.net/cslanet/Default.aspx" target="_blank">Rockford Lhotka&#8217;s CSLA.Net framework</a>, and my first attempts at testing for persistence did so by reading the database tables to verify the data written &#8211; in the same unit test..</p>
<p><img src="/images/unit_testing_1.png" alt="Unit Testing - first attempts" width="260" height="289" /></p>
<p>In practice, these unit test cases were well over a screen full of code which, when testing different scenario&#8217;s around the edit and save logic, meant I&#8217;d created an overhead that added a quite considerable amount of time to their maintenance when features were added and changes were inevitably made to the application code being tested.</p>
<p>I was already thinking about separating out the unit test code into it&#8217;s component parts to make handling change less painful, when I saw the title of <a title=".Net Rocks!  The audio talk show for .Net developers" href="http://www.dotnetrocks.com/" target="_blank">Carl and Richard&#8217;s audio talk show &#8220;Dot Net Rocks!&#8221;</a> <a title=".Net Rocks - Show 312 - Andy Leonard on Unit Testing your Database" href="http://www.dotnetrocks.com/default.aspx?showNum=312" target="_blank">#312 &#8211; &#8220;Andy Leonard on Unit Testing your Database&#8221;</a>. Being a Database guy, Andy&#8217;s main reason for unit testing the Database is that we developers  sometimes forget that <a title="Wikipedia - Stored Procedure" href="http://en.wikipedia.org/wiki/Stored_procedure" target="_blank">we write code there</a>, and that <strong>our Database code is as much a part of the application</strong> &#8211; but I think his rationale also solves the maintenance issue with my single, large unit tests..</p>
<p><img src="/images/unit_testing_2.png" alt="Unit Testing - separating out the database layer" width="260" height="289" /></p>
<p><strong>By separating out the unit tests to check the Database layer, it massively simplifies the readability and maintenance of the application layer unit tests.</strong> Moreover, if you locate the Database layer unit tests in their own library, then they can be executed before the application layer unit tests so they can halt further testing as it&#8217;s highly likely that failure at the lower database level will manifest itself higher up. This will ultimately save us time locating and fixing failing code, as well as saving time modifying existing unit tests when changes occur.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fatlemon.co.uk/2008/02/how-far-should-your-unit-tests-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing useful comments</title>
		<link>http://www.fatlemon.co.uk/2008/01/writing-useful-comments/</link>
		<comments>http://www.fatlemon.co.uk/2008/01/writing-useful-comments/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 18:00:48 +0000</pubDate>
		<dc:creator>Andrew Freemantle</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Comments]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.fatlemon.co.uk/?p=1</guid>
		<description><![CDATA[It was drummed into me throughout my software engineering training years &#8211; the essential internal documentation of software &#8211; the comment. After a few years actually engineering software, I&#8217;ve found that I can categorise most comments into 4 basic types: The obsolete code block, often with an accompanying note about why it was removed or [...]]]></description>
			<content:encoded><![CDATA[<p>It was drummed into me throughout my software engineering training years &#8211; the essential internal documentation of software &#8211; the <a title="Wikipedia - Comment (Computer Programming)" href="http://en.wikipedia.org/wiki/Comment_%28computer_programming%29" target="_blank">comment</a>.</p>
<p>After a few years actually engineering software, I&#8217;ve found that I can categorise most comments into 4 basic types:</p>
<ol>
<li>The obsolete code block, often with an accompanying note about why it was removed or replaced</li>
<li>The overly-verbose or overly-descriptive, highlighting the obvious</li>
<li>The reference; a Bug tracking reference number or <abbr title="Uniform Resource Locator - Hyperlink">URL</abbr> link to where the block of code originated</li>
<li>The one or two-liner descriptive, concise explanation</li>
</ol>
<p>And having done so, <strong>I have found that the first 3 are actually detrimental to the process of maintaining or  otherwise changing software</strong>. Let&#8217;s look at them in closer detail to find out why..</p>
<p>1.  If we&#8217;re using any <a title="Coding Horror - Source Control: Anything But SourceSafe" href="http://www.codinghorror.com/blog/archives/000660.html" target="_blank">decent form of source code version control</a>, then there is no benefit whatsoever to leaving commented out, obsolete code blocks in the software &#8211; in fact, I&#8217;d argue that when following a thread of logic through function to function, <strong>having to skip over comments that look like code is actually detrimental to understanding why the code does what it does</strong>. Consider that source control makes it a trivial task to compare or replace the current code with any previous checked-in version of the code, and there simply isn&#8217;t a sensible reason to leave old code in place.</p>
<p>2. I take this to be an indication that there is no accompanying documentation, or it\&#8217;s going to be sparse at best. If it\&#8217;s a block comment about why a particular feature exists then a better place for it is in some form of requirements documentation; if it&#8217;s a block comment about a design decision then it would be better placed in the design documentation. <strong>Any other documentation format easily wins over plain-text descriptions</strong>, and designs are better illustrated, well, with illustrations.</p>
<p>3. I&#8217;ve worked out that both of the above are bad, yet I still catch myself thinking that it&#8217;s somehow beneficial to the maintenance of the code if I include a Bug tracking reference number next to the code I&#8217;ve changed. If I&#8217;m coming back to the code because of a problem with the fix I&#8217;ve made, then <strong>it&#8217;s much easier to search through the source code version control check-in comments for the Bug reference number than through the source code itself</strong> &#8211; if only because it&#8217;ll be a hell of a lot faster. If I&#8217;m in the code for another reason &#8211; say I&#8217;m adding something new &#8211; finding a Bug tracking number isn&#8217;t going to make me head off to the Bug System and look up it&#8217;s history.. I know what the code is doing because I&#8217;m in there reading it and stepping through it. <abbr title="Uniform Resource Locator - Hyperlink">URL</abbr>s serve as a similar distraction from the actual workings of the software. That said, I think <abbr title="Uniform Resource Locator - Hyperlink">URL</abbr>s are useful in referencing the origin of an entire Class, algorithm or Library.</p>
<p>4. The most helpful comments I&#8217;ve found are the concise, single-line description of what&#8217;s going on that help keep the reader on track &#8211; such as what we&#8217;re looping through or why we&#8217;re looping when we&#8217;re 2 or 3 <a title="Wikipedia - Array" href="http://en.wikipedia.org/wiki/Array" target="_blank">Arrays</a> deep. <strong>Like breadcrumbs, they assist you and your maintainer in un-ravelling the mystery of your software</strong>.</p>
<p>I&#8217;ve found that putting as much thought into the content of my comments, as I do into the content of my code, makes it much easier to maintain my software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fatlemon.co.uk/2008/01/writing-useful-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

