<?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>Crafting software&#187; Software Craftmanship</title>
	<atom:link href="http://davidlaing.com/category/software-craftmanship/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidlaing.com</link>
	<description>David Laing&#039;s thoughts on software development</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:02:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Functional programming in Javascript and F#</title>
		<link>http://davidlaing.com/2011/06/19/functional-programming-in-javascript-and-f/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=functional-programming-in-javascript-and-f</link>
		<comments>http://davidlaing.com/2011/06/19/functional-programming-in-javascript-and-f/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 09:39:00 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=295</guid>
		<description><![CDATA[During June 2011 I presented a session at the SPA2011 conference in London, UK. My session was a hands on introduction to functional programming techniques with code samples in Javascript and F#. The focus on the session was to get peopling thinking about first class functions; and the techniques they enable to simplify and increase [...]]]></description>
			<content:encoded><![CDATA[<p>During June 2011 I presented a session at the <a href="http://www.spaconference.org/spa2011/index.php?page=programme">SPA2011</a> conference in London, UK. </p>
<p>My session was a hands on introduction to functional programming techniques with code samples in Javascript and F#.  The focus on the session was to get peopling thinking about first class functions; and the techniques they enable to simplify and increase readability of code when solving certain classes of problems.</p>
<p>The code samples can be found at:</p>
<ul>
<li>Javascript &#8211; <a href="https://github.com/mrdavidlaing/functional-javascript">https://github.com/mrdavidlaing/functional-javascript</a> </li>
<li>F# &#8211;  <a href="https://github.com/mrdavidlaing/functional-fsharp">https://github.com/mrdavidlaing/functional-fsharp</a></li>
</ul>
<p>An online/executable version of the Javascript code is at <a href="http://functional-javascript.davidlaing.com">http://functional-javascript.davidlaing.com</a>.</p>
<p>Judging by the feedback I received, the session went very well.  People seemed to like the hands-on format of the session; and just being left alone for a while to learn something at their own pace.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2011/06/19/functional-programming-in-javascript-and-f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementing the strategy pattern without an explosion of classes &#8211; part 3 of ??</title>
		<link>http://davidlaing.com/2011/04/16/implementing-the-strategy-pattern-without-an-explosion-of-classes-part-3-of/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=implementing-the-strategy-pattern-without-an-explosion-of-classes-part-3-of</link>
		<comments>http://davidlaing.com/2011/04/16/implementing-the-strategy-pattern-without-an-explosion-of-classes-part-3-of/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 21:51:25 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Code smells]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://davidlaing.radweb.co.za/?p=272</guid>
		<description><![CDATA[I feel uncomfortable when I see large switch statements. I appreciate how they break the Open Closed Principle. I have enough experience to know that they seem to attract extra conditions &#38; additional logic during maintenance, and quickly become bug hotspots. A refactoring I use frequently to deal with this is Replace Conditional with Polymorphism; [...]]]></description>
			<content:encoded><![CDATA[<p>I feel uncomfortable when I see large switch statements.  I appreciate how they break the <a href="http://en.wikipedia.org/wiki/Open/closed_principle">Open Closed Principle</a>.  I have enough experience to know that they seem to attract extra conditions &amp; additional logic during maintenance, and quickly become bug hotspots.</p>
<p>A refactoring I use frequently to deal with this is <a href="http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html">Replace Conditional with Polymorphism</a>; but for simple switches, its always seemed like a rather large hammer.</p>
<p>Take the following simple example that performs slightly different processing logic based on the credit card type:</p>
<p><script src="https://gist.github.com/923516.js?file=CreditCard-simple-switch.js"></script> Its highly likely that the number of credit card types will increase; and that the complexity of processing logic for each will also increase over time.  The traditional application of the <a href="http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html">Replace Conditional with Polymorphism</a> refactoring gives the following:  </p>
<p><script src="https://gist.github.com/923516.js?file=CreditCard-simple-strategy.js"></script></p>
<p>This explosion of classes containing almost zero logic has always bothered me as quite a lot of boilerplate overhead for a relatively small reduction in complexity.</p>
<p>Consider however, the functional approach to the same refactoring:</p>
<p><script src="https://gist.github.com/923516.js?file=CreditCard-simple-functional.js"></script> </p>
<p>Here we have obtained the same simplification of the switch statement; but avoided the explosion of simple classes.  Whilst strictly speaking we are still violating the  <a href="http://en.wikipedia.org/wiki/Open/closed_principle">Open Closed Principle</a>; we do have a collection of simple methods that are easy to comprehend and test.  It&#8217;s worth noting that when our logic becomes very complex; converting to the OO Strategy pattern becomes a more compelling option.  Consider the case when we include a collection of validation logic for each credit card:  <script src="https://gist.github.com/923516.js?file=CreditCard-complex-functional.js"></script></p>
<p>In this case the whole file starts to feel too complex to me; and having the logic partitioned into separate strategy classes / files seems more maintainable to me.</p>
<p><script src="https://gist.github.com/923516.js?file=CreditCard-complex-strategy.js"></script></p>
<p>To conclude then, the fact that languages treat functions as first class constructs, gives us the flexibility to use them in a &#8220;polymorphic&#8221; way; where our &#8220;interface&#8221; is the function signature.  </p>
<p>And for some problems, like a refactoring a simple switch statement; I feel this gives us a more elegant solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2011/04/16/implementing-the-strategy-pattern-without-an-explosion-of-classes-part-3-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Higher order functions &#8211; simplifying loops &#8211; part 2 of ??</title>
		<link>http://davidlaing.com/2011/04/04/higher-order-functions-simplifying-loops-part-2-of/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=higher-order-functions-simplifying-loops-part-2-of</link>
		<comments>http://davidlaing.com/2011/04/04/higher-order-functions-simplifying-loops-part-2-of/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 21:50:07 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Functional Programming]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=264</guid>
		<description><![CDATA[This is the 2nd part of my series on everyday functional programming. Filtering Suppose you have a collection of items and need to grab just a subset that match a certain criteria. Programming C# in an imperative style, you could use a for or foreach loop as follows: Functional programming recognises this common scenario as [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 2nd part of my series on everyday functional programming.</p>
<h2>Filtering</h2>
<p>Suppose you have a collection of items and need to grab just a subset that match a certain criteria.  Programming  C# in an imperative style, you could use a for or foreach loop as follows:</p>
<p><script src="https://gist.github.com/902523.js?file=basic_for_loop.cs"></script></p>
<p>Functional programming recognises this common scenario as a higher order function known as a Filter [3]; where you want to create a new list for every element that evaluates to true when a predicate function is applied to it.</p>
<p>In C#, filter is implemented as the LINQ Where(Func<TItem, Boolean>)) extension method, allowing one to write the following:</p>
<p><script src="https://gist.github.com/902523.js?file=filter_using_Where.cs"></script></p>
<p>Apart from the obvious reduction in number of lines; notice how much clearer the intent of the filter is, and the  many opportunities for error we have eliminated.</p>
<p>In Javascript we use the filter function:</p>
<p><script src="https://gist.github.com/902523.js?file=filter.js"></script></p>
<h2>Mapping</h2>
<p>In many instances you find yourself wanting to perform the same operation on every item in an existing collection.  In Javascript in an imperative style we might want to do the following</p>
<p><script src="https://gist.github.com/902523.js?file=map_using_for.js"></script></p>
<p>In functional programming this is know as the higher order function: Map [4] and in Javascript can be applied using a single statement map()</p>
<p><script src="https://gist.github.com/902523.js?file=map_using_array.map.js"></script></p>
<p>In C#, map is implemented by the LINQ Select(Func<TSource, TResult>) extension method:</p>
<p><script src="https://gist.github.com/902523.js?file=map_using_select.cs"></script></p>
<p>[1] &#8211; http://railspikes.com/2008/7/29/functional-loops-in-ruby-each-map-inject-select-and-for<br />
[2] &#8211; http://msdn.microsoft.com/en-us/library/system.linq.enumerable.aspx<br />
[3] &#8211; http://en.wikipedia.org/wiki/Filter_(higher-order_function)<br />
[4] &#8211; http://en.wikipedia.org/wiki/Map_(higher-order_function)</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2011/04/04/higher-order-functions-simplifying-loops-part-2-of/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Everyday functional programming &#8211; part 1 of ??</title>
		<link>http://davidlaing.com/2011/04/04/everyday-functional-programming-part-1-of/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=everyday-functional-programming-part-1-of</link>
		<comments>http://davidlaing.com/2011/04/04/everyday-functional-programming-part-1-of/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 20:53:10 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Functional Programming]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=254</guid>
		<description><![CDATA[This is the first of a series of blog posts where I will be exploring how functional programming techniques are useful in the daily life of a working &#8220;enterprise software&#8221; developer. If you, like me, began programming in the 1990&#8242;s, then you will probably have started in a procedural programming style with simple task orientated [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first of a series of blog posts where I will be exploring how functional programming techniques are useful in the daily life of a working &#8220;enterprise software&#8221; developer.</p>
<p>If you, like me, began programming in the 1990&#8242;s, then you will probably have started in a procedural programming style with simple task orientated scripts, and then progressed to an object oriented style for its better fit with event orientated GUI applications.  As the software craftsmanship movement has grown over the past few years, you will have honed your S.O.L.I.D. OO skills; and focussed on making your code maintainable &amp; testable/ed.</p>
<p>Whilst functional programming has an academic &amp; computational background; functional elements have begun finding their way into mainstream languages.  In this series of articles I&#8217;ll be concentrating on the two languages I am most familiar with &#8211; C# and Javascript &#8211; and how exploiting the functional programming features in these can help to make the code you and I write every day more expressive &amp; maintainable, and in some instances dramatically more scalable.</p>
<p>I won&#8217;t be trying to explain the concepts behind functional programming &#8211; others have done an exellent job of that already; so I&#8217;ll just link to them [<a href="#1">1</a>] [<a href="#2">2</a>].  Rather, I&#8217;ll be curating practical examples where a functional style can be applied to everyday programming problems.</p>
<ol>
<li><a href="http://davidlaing.com/2011/04/04/higher-order-functions-simplifying-loops-part-2-of/">Higher order functions &#8211; simplifying loops</a></li>
<li><a href="http://davidlaing.com/2011/04/16/implementing-t…sses-part-3-of/">Implementing the strategy pattern without an explosion of classes</a></li>
<li>Side effect free functions &#8211; code that is easy to test &amp; reuse</li>
</ol>
<p><a name="1" href="http://en.wikipedia.org/wiki/Functional_programming">[1] &#8211; http://en.wikipedia.org/wiki/Functional_programming</a><br />
<a name="2" href="http://www.defmacro.org/ramblings/fp.html">[2] &#8211; http://www.defmacro.org/ramblings/fp.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2011/04/04/everyday-functional-programming-part-1-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Defect Exception</title>
		<link>http://davidlaing.com/2011/02/18/a-defect-exception/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-defect-exception</link>
		<comments>http://davidlaing.com/2011/02/18/a-defect-exception/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 13:50:08 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Software Craftmanship]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=250</guid>
		<description><![CDATA[Occasionally one comes across a idea that is just brilliant. How often have you been writing a bit of code, and got to a point where you think &#8220;gee, if the program ever gets into this state, then something is really wrong&#8221;. Throwing an exception seems appropriate, but what kind of exception to throw? Enter [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally one comes across a idea that is just brilliant.</p>
<p>How often have you been writing a bit of code, and got to a point where you think &#8220;gee, if the program ever gets into this state, then something is really wrong&#8221;.  Throwing an exception seems appropriate, but what kind of exception to throw?</p>
<p>Enter the following sage advise from Steve Freeman and Nat Pryce in their great book <a href="http://www.growing-object-oriented-software.com/">&#8220;Growing Object Orientated Software Guided by Tests&#8221;</a>:</p>
<div id="attachment_249" class="wp-caption aligncenter" style="width: 310px"><a href="http://davidlaing.com/files/2011/02/GrowingObjectOrientatedSoftwareGuidedByTests-pg165.png"><img src="http://davidlaing.com/files/2011/02/GrowingObjectOrientatedSoftwareGuidedByTests-pg165-300x78.png" alt="Growing Object Orientated Software Guided By Tests - pg165" width="300" height="78" class="size-medium wp-image-249" /></a><p class="wp-caption-text">Growing Object Orientated Software Guided By Tests - pg165</p></div>
<p>A DefectException().  What a simple but brilliant idea!</p>
<p>Thanks guys</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2011/02/18/a-defect-exception/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning functional Javascript through Koans</title>
		<link>http://davidlaing.com/2010/07/19/learning-functional-javascript-through-koans/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-functional-javascript-through-koans</link>
		<comments>http://davidlaing.com/2010/07/19/learning-functional-javascript-through-koans/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 23:37:39 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Software Craftmanship]]></category>
		<category><![CDATA[koans; javascript; functional]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=236</guid>
		<description><![CDATA[Given how Javascript interpreters are improving in leaps and bounds; and that it seems to be the only language that will be supported by all web devices; its time to for me to revive my Javascript skilz. Fortunately the tooling has improved greatly; Eclipse 3.6 for Web Developers and JsTestDriver bring a refactoring and a [...]]]></description>
			<content:encoded><![CDATA[<p>Given how Javascript interpreters are improving in leaps and bounds; and that it seems to be the only language that will be supported by all web devices; its time to for me to revive my Javascript skilz.  Fortunately the tooling has improved greatly; Eclipse 3.6 for Web Developers and JsTestDriver bring a refactoring and a unit test runner to Javascript development.</p>
<p>Interestingly, Javascript seems to have more functional than object orientated characteristics; so it seems reasonable to learn it wearing my functional hat.</p>
<p>I&#8217;ve been enjoying learning Ruby syntax via <a href="http://github.com/edgecase/ruby_koans">RubyKoans &#8211; little tests that teach you syntax and convention as you make them pass</a></p>
<p>I though I&#8217;d create a similar set of <a href="https://github.com/mrdavidlaing/javascript-koans">Functional Javascript Koans</a> to help refresh my Javascript skills.</p>
<p>Its a bit rough; so please fork and contibute back improvements.<br />
<a href="https://github.com/mrdavidlaing/javascript-koans">https://github.com/mrdavidlaing/javascript-koans</a></p>
<p><object width="490" height="310"><param name="movie" value="http://www.youtube.com/v/qAoWxXPLB0Q&amp;hl=en_US&amp;fs=1?rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qAoWxXPLB0Q&amp;hl=en_US&amp;fs=1?rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="490" height="310"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/07/19/learning-functional-javascript-through-koans/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fitnesse Smell &#8211; Executable Requirements that look like Scripts</title>
		<link>http://davidlaing.com/2010/06/16/fitnesse-smell-executable-requirements-that-look-like-scripts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fitnesse-smell-executable-requirements-that-look-like-scripts</link>
		<comments>http://davidlaing.com/2010/06/16/fitnesse-smell-executable-requirements-that-look-like-scripts/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 14:11:19 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Code smells]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[acceptance tests]]></category>
		<category><![CDATA[codesmell]]></category>
		<category><![CDATA[fitnesse]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=232</guid>
		<description><![CDATA[Gojko (who wrote the Fitnesse book) has this interesting discussion on what makes a good acceptance test in Fitnesse. http://gojko.net/2010/06/16/anatomy-of-a-good-acceptance-test/ His point seems to be that Fitnesse is a good tool for documenting specifications, and continuously automating their validation. When your Fitnesse tests become like &#8220;scripts&#8221; (which is how developers are trained to see the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gojko.net">Gojko</a> (who wrote the <a href="http://gojko.net/2009/12/07/fitnesse-book-now-free-online/">Fitnesse book</a>) has this interesting discussion on what makes a good acceptance test in Fitnesse.</p>
<p><a href="http://gojko.net/2010/06/16/anatomy-of-a-good-acceptance-test/">http://gojko.net/2010/06/16/anatomy-of-a-good-acceptance-test/</a></p>
<p>His point seems to be that Fitnesse is a good tool for documenting specifications, and continuously automating their validation.  When your Fitnesse tests become like &#8220;scripts&#8221; (which is how developers are trained to see the world), then Fitnesse is a pretty crummy test execution environment (just use a unit test runner!)</p>
<p>Interesting that alternate tools &#8211; http://www.concordion.org, http://wiki.github.com/aslakhellesoy/cucumber/, http://www.specflow.org/ have arisen that effectively try to limit the power of the &#8220;test description language&#8221; to prevent the acceptance tests becoming script like.</p>
<p>Interesting food for thought &#8211; I know that many of my Fitnesse tests exhibit this codesmell</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/06/16/fitnesse-smell-executable-requirements-that-look-like-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Pair Programming Doesn&#8217;t Reduce Productivity</title>
		<link>http://davidlaing.com/2010/06/06/why-pair-programming-doesnt-reduce-productivity/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=why-pair-programming-doesnt-reduce-productivity</link>
		<comments>http://davidlaing.com/2010/06/06/why-pair-programming-doesnt-reduce-productivity/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 15:15:50 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Pair Programming]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=220</guid>
		<description><![CDATA[The other day I was asked why pair programming doesn&#8217;t reduce productivity; and its taken me a few days to come up with a this succinct answer &#8211; because we&#8217;re building a system to release software changes rapidly over a long period of time, not type more lines of code to reach some predefined goal [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was asked why pair programming doesn&#8217;t reduce productivity; and its taken me a few days to come up with a this succinct answer &#8211; </p>
<blockquote><p>because we&#8217;re building a system to release software changes rapidly over a long period of time, not type more lines of code to reach some predefined goal post
</p></blockquote>
<p>The purpose of a software team is to deliver a working software solution that solves customer&#8217;s problems over a long period of time.  </p>
<p>This would be easy if:</p>
<ol>
<li>Customers knew what they wanted</li>
<li>Developers knew how to deliver the features</li>
<li>The world remained the same on the day the software is released as it was at the time it was designed.</li>
</ol>
<p>The trouble is that none of these are true.  We have to guess at the right solution, get some real world experience with it, and then optimise when we know more about the problem domain (aka, after we have delivered the feature for the first time).</p>
<p>The way to do this better is to reduce the length of the feedback cycle (think 5 days, not 6 months), and grow a system that can rapidly and repeatedly deliver changes to the software over the life (years) of that software.</p>
<p>Pair programming contributes directly to growing this system by:</p>
<ul>
<li>Facilitating communication about the architecture &amp; design of the system, and ensuring everyone actually understands it</li>
<li>Reducing brittleness &amp; bottlenecks caused by one person &#8220;owning&#8221; a core module</li>
<li>Improving consistency and adherence to common standards</li>
<li>Catching bugs at the cheapest time to fix them</li>
</ul>
<p>Unintuatively, it also tends to ensure that developers actually spend longer working on the software by:</p>
<ul>
<li>Reducing &#8220;wander time&#8221;.  You are less likely to get sidetracked into email, facebook or some interesting blog article when pairing.</li>
<li>Reducing &#8220;stuck time&#8221;.  Two perspectives on a problem have twice as many solutions to try out</li>
</ul>
<p>These articles go into more depth:</p>
<ul>
<li><a href="http://www.menloinnovations.com/freestuff/whitepapers/pairedprogramming_qanda.htm">http://www.menloinnovations.com/freestuff/whitepapers/pairedprogramming_qanda.htm </a></li>
<li><a href="http://anarchycreek.com/2009/05/26/how-tdd-and-pairing-increase-production/">http://anarchycreek.com/2009/05/26/how-tdd-and-pairing-increase-production/</a></a></li>
</ul>
<p>To conclude, pair programming would be a unproductive if developers had the perfect solution is their head, and programming was just the task of typing that into the computer to release a single perfect version of the software.</p>
<p>But in the real world we we&#8217;re in the business of creating a system that can rapidly deliver changes to the software as it narrows in on, and adapts to the best solution to the problem at hand.  And to do this, pair programming excels.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/06/06/why-pair-programming-doesnt-reduce-productivity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CI for Flex 4; running FlexUnit4 unit tests and FlexMonkey4 acceptance tests with Maven and FlexMojos</title>
		<link>http://davidlaing.com/2010/06/04/ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos</link>
		<comments>http://davidlaing.com/2010/06/04/ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 23:21:08 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Continuous Deployment]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=216</guid>
		<description><![CDATA[The FlexMojos project is a great way to bring your Flex application under a grown up continuous build system like Maven. Getting FlexMojos 3.6.1 working with Flex 4, running Flash Builder 4&#8242;s version of unit tests and FlexMonkey4&#8242;s version of acceptance/UI tests is pretty tricky. Hopefully this sample project &#8211; http://github.com/mrdavidlaing/flexmojos-sample along with this screencast [...]]]></description>
			<content:encoded><![CDATA[<p>The FlexMojos project is a great way to bring your Flex application under a grown up continuous build system like Maven.</p>
<p>Getting FlexMojos 3.6.1 working with Flex 4, running Flash Builder 4&#8242;s version of unit tests and FlexMonkey4&#8242;s version of acceptance/UI tests is pretty tricky.</p>
<p>Hopefully this sample project &#8211; <a href="http://github.com/mrdavidlaing/flexmojos-sample">http://github.com/mrdavidlaing/flexmojos-sample</a> along with this screencast will save someone else the pain I went through to get all these playing together.</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=12228897&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=12228897&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>
<p><a href="http://vimeo.com/12228897">Howto add new component to FlexITP</a> from <a href="http://vimeo.com/user2901435">David Laing</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Patches welcome &#8211; just clone the git repo make your change, and request a pull.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/06/04/ci-for-flex-4-running-flexunit4-unit-tests-and-flexmonkey4-acceptance-tests-with-maven-and-flexmojos/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DTOs: To Flatten Or Not To Flatten?</title>
		<link>http://davidlaing.com/2010/04/20/dtos-to-flatten-or-not-to-flatten/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dtos-to-flatten-or-not-to-flatten</link>
		<comments>http://davidlaing.com/2010/04/20/dtos-to-flatten-or-not-to-flatten/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 06:58:39 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Software Craftmanship]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[design_patterns]]></category>
		<category><![CDATA[dtos]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=200</guid>
		<description><![CDATA[that is the question&#8230; I&#8217;m busy working on a JSON based API with client libraries in Flex, C# and Javascript (and eventually iPhone, JavaFX etc). One of the things the API deals with is the concept of a Market. Markets have a number of properties that &#8220;belong&#8221; to them, simplistically things like MarketId and Name. [...]]]></description>
			<content:encoded><![CDATA[<p>that is the question&#8230;</p>
<p>I&#8217;m busy working on a JSON based API with client libraries in Flex, C# and Javascript (and eventually iPhone, JavaFX etc).</p>
<p>One of the things the API deals with is the concept of a Market.  Markets have a number of properties that &#8220;belong&#8221; to them, simplistically things like MarketId and Name.</p>
<pre class="brush: csharp; title: ; notranslate">
public class Market
{
    public int MarketId {get; set;}
    public string Name {get; set;}
}
</pre>
<p>However, I can see that in using a list of markets, its going to be useful to know related data about the market for things like sorting. For example, when showing a list of markets I&#8217;d like to know the volume traded in the last day so I can colour them differently.  Or the price change in the last hour etc.</p>
<p>DTO wise, there seem to be several options.</p>
<ol>
<li>
<h4>Flattening with &#8220;nulls&#8221;</h4>
<pre class="brush: csharp; title: ; notranslate">
public class Market
{
    public int MarketId {get; set;}
    public string Name {get; set;}
    public decimal? VolumeInLastDay {get; set;}
    public decimal? PriceDeltaLastHour {get; set;}
}
</pre>
<p>It seems that over time this approach will lead to very &#8220;messy&#8221; DTOs where you&#8217;re forced to do a lot of &#8220;isNull&#8221; style checking before attempting to display things.
</li>
<li>
<h4>Multiple specific MarketWithXYZ DTOS</h4>
<pre class="brush: csharp; title: ; notranslate">
public class MarketWithVolume: Market
{
    public decimal VolumeInLastDay {get; set;}
}

public class MarketWithPriceDelta: Market
{
    public decimal PriceDeltaLastHour {get; set;}
}

public class MarketWithVolumeAndPriceDelta: MarketWithVolume
{
    public decimal? PriceDeltaLastHour {get; set;}
}
</pre>
<p>An explosion of DTOs, but at least you know exactly what data you&#8217;ve got at any instance
</li>
<li>
<h4>Property Bags</h4>
<pre class="brush: csharp; title: ; notranslate">
public class Market
{
    public int MarketId {get; set;}
    public string Name {get; set;}
    public Hashtable RelatedData {get; set;}
}

decimal delta = Market.RelatedData[&quot;PriceDeltaLastHour &quot;];
</pre>
<p>In a way this feels even worse than having multiple null attributes; especially for someone new to the API because you won&#8217;t know until run time which data is available.
</li>
</ol>
<p>How have you approached this problem in the past?  What works, and what doesn&#8217;t?  Comments much appreciated.</p>
<p><strong>Update</strong></p>
<ul>
<li>Reduced duplication in Multiple specific option using inheritance</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2010/04/20/dtos-to-flatten-or-not-to-flatten/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

