<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for codeSMART</title>
	<atom:link href="http://codesmart.wordpress.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://codesmart.wordpress.com</link>
	<description>Coding, development, general ranting - what more do you want?</description>
	<lastBuildDate>Tue, 06 Oct 2009 23:53:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on The argument against Test Driven Development by Sim'</title>
		<link>http://codesmart.wordpress.com/2009/10/07/the-argument-against-test-driven-design/#comment-93</link>
		<dc:creator>Sim'</dc:creator>
		<pubDate>Tue, 06 Oct 2009 23:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=225#comment-93</guid>
		<description>I like to think back to some of the pure mathematics subjects I did in uni (which I actually quite enjoyed - much more so than the applied mathematics!), the concept of Mathematical Induction comes to mind when testing code.

From Wikipedia: &quot;Mathematical induction is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers. It is done by proving that the first statement in the infinite sequence of statements is true, and then proving that if any one statement in the infinite sequence of statements is true, then so is the next one.&quot;

... then applying this to testing code ... if a function received a set of inputs and then has an expected output, you could (theoretically) derive a formula representing the (mathematical) function of the (programming) function - and then test that the function gives the correct result for all possible cases of input values.

Testing end-cases, or extremities is also critical, particularly when dealing with very large numbers. I recently had a case where I wrote a script to extract certain posts (status updates) from Twitter and store them in a database - what I didn&#039;t take into account was the extreme case of the twitter statusid (a unique integer assigned to every status update) incrementing to the point where it exceeded the bounds of a 32-bit unsigned integer. Oops. Because I was using a loosely typed language (PHP), my code didn&#039;t break, but my database table was set to expect a 32-bit unsigned integer, and rather than throwing up an error when it received something larger, it instead reset the integer to the largest possible value ... so the error I received was actually a &quot;duplicate key&quot; error, rather than what I might have expected - something like &quot;number too large&quot; (which in retrospect was a bit silly to expect, given how computers tend to represent large numbers).

Another point I think is worth making is that use-cases and user stories are all well and good, but in many cases, they only represent what the &quot;user&quot; (often a business user with little technical ability) wants or needs, with little regard to the future requirements. This can lead to code being developed which is non-portable and not very extensible. 

Taking your example - if the use-case is that the integers will only ever be n=1 or n=2 (because this is what the company currently does), then your simple switch/if-then-else methodology would easily be the most elegant solution which meets all specified use-cases. However, if the company ever changes policy or through mergers and acquisitions faces a previously inconceivable value for n, then the code needs to be revisited to make it work. 

If the code  had been written to cater for more general cases, had been built with extensibility and flexibility in mind, then many of these issues would go away. 

Of course, I guess this is the point of TDD to a degree - why waste time building code to cater for something which might not happen? Re-usability and elegant design is nice in theory, but you waste a lot of effort and introduce a lot of complexity coding for something that isn&#039;t actually needed, and may never be.</description>
		<content:encoded><![CDATA[<p>I like to think back to some of the pure mathematics subjects I did in uni (which I actually quite enjoyed &#8211; much more so than the applied mathematics!), the concept of Mathematical Induction comes to mind when testing code.</p>
<p>From Wikipedia: &#8220;Mathematical induction is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers. It is done by proving that the first statement in the infinite sequence of statements is true, and then proving that if any one statement in the infinite sequence of statements is true, then so is the next one.&#8221;</p>
<p>&#8230; then applying this to testing code &#8230; if a function received a set of inputs and then has an expected output, you could (theoretically) derive a formula representing the (mathematical) function of the (programming) function &#8211; and then test that the function gives the correct result for all possible cases of input values.</p>
<p>Testing end-cases, or extremities is also critical, particularly when dealing with very large numbers. I recently had a case where I wrote a script to extract certain posts (status updates) from Twitter and store them in a database &#8211; what I didn&#8217;t take into account was the extreme case of the twitter statusid (a unique integer assigned to every status update) incrementing to the point where it exceeded the bounds of a 32-bit unsigned integer. Oops. Because I was using a loosely typed language (PHP), my code didn&#8217;t break, but my database table was set to expect a 32-bit unsigned integer, and rather than throwing up an error when it received something larger, it instead reset the integer to the largest possible value &#8230; so the error I received was actually a &#8220;duplicate key&#8221; error, rather than what I might have expected &#8211; something like &#8220;number too large&#8221; (which in retrospect was a bit silly to expect, given how computers tend to represent large numbers).</p>
<p>Another point I think is worth making is that use-cases and user stories are all well and good, but in many cases, they only represent what the &#8220;user&#8221; (often a business user with little technical ability) wants or needs, with little regard to the future requirements. This can lead to code being developed which is non-portable and not very extensible. </p>
<p>Taking your example &#8211; if the use-case is that the integers will only ever be n=1 or n=2 (because this is what the company currently does), then your simple switch/if-then-else methodology would easily be the most elegant solution which meets all specified use-cases. However, if the company ever changes policy or through mergers and acquisitions faces a previously inconceivable value for n, then the code needs to be revisited to make it work. </p>
<p>If the code  had been written to cater for more general cases, had been built with extensibility and flexibility in mind, then many of these issues would go away. </p>
<p>Of course, I guess this is the point of TDD to a degree &#8211; why waste time building code to cater for something which might not happen? Re-usability and elegant design is nice in theory, but you waste a lot of effort and introduce a lot of complexity coding for something that isn&#8217;t actually needed, and may never be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Japan &#8211; Days 2 to about 5 by Steve Allen</title>
		<link>http://codesmart.wordpress.com/2009/09/10/japan-days-2-to-about-5/#comment-88</link>
		<dc:creator>Steve Allen</dc:creator>
		<pubDate>Sun, 13 Sep 2009 08:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=158#comment-88</guid>
		<description>Thanks for the pictures.  Very interesting.</description>
		<content:encoded><![CDATA[<p>Thanks for the pictures.  Very interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Japan &#8211; The Last Day by Steve Allen</title>
		<link>http://codesmart.wordpress.com/2009/09/11/japan-the-last-day/#comment-87</link>
		<dc:creator>Steve Allen</dc:creator>
		<pubDate>Sun, 13 Sep 2009 08:43:54 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=188#comment-87</guid>
		<description>Thanks Darren.  Sounds like Japan may be a bit like Singapore; neat and clean but sterile.  If the airport island is artificial you have to ask why they didn&#039;t build it a bit closer!  I&#039;ll ignore the hill of beans thing - don&#039;t want to know!</description>
		<content:encoded><![CDATA[<p>Thanks Darren.  Sounds like Japan may be a bit like Singapore; neat and clean but sterile.  If the airport island is artificial you have to ask why they didn&#8217;t build it a bit closer!  I&#8217;ll ignore the hill of beans thing &#8211; don&#8217;t want to know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Japan &#8211; Days 2 to about 5 by Sarah</title>
		<link>http://codesmart.wordpress.com/2009/09/10/japan-days-2-to-about-5/#comment-86</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Fri, 11 Sep 2009 00:21:14 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=158#comment-86</guid>
		<description>Ha Ha good to see you managed to get your caffeine fix. Very cool photos love the roll up tree and the chair tree shame the train didn&#039;t have Ben 10 on it though, Thomas is So last year in our house :-)</description>
		<content:encoded><![CDATA[<p>Ha Ha good to see you managed to get your caffeine fix. Very cool photos love the roll up tree and the chair tree shame the train didn&#8217;t have Ben 10 on it though, Thomas is So last year in our house <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Japan &#8211; Day 1 by Sarah</title>
		<link>http://codesmart.wordpress.com/2009/09/07/japan-day-1/#comment-85</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Fri, 11 Sep 2009 00:18:21 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=147#comment-85</guid>
		<description>Glad to see you are catching up on Pinky and I sincerely hope that during your stay you don&#039;t bugle any fire alarms, sounds Australian when you put it like that.</description>
		<content:encoded><![CDATA[<p>Glad to see you are catching up on Pinky and I sincerely hope that during your stay you don&#8217;t bugle any fire alarms, sounds Australian when you put it like that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Japan &#8211; Day 1 by Phil Oster</title>
		<link>http://codesmart.wordpress.com/2009/09/07/japan-day-1/#comment-84</link>
		<dc:creator>Phil Oster</dc:creator>
		<pubDate>Mon, 07 Sep 2009 22:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=147#comment-84</guid>
		<description>Great spiel Uncle Ray. Welcome to Asia. Forget chop-sticks: may the fork be with you....!</description>
		<content:encoded><![CDATA[<p>Great spiel Uncle Ray. Welcome to Asia. Forget chop-sticks: may the fork be with you&#8230;.!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending the Microsoft ASP.NET Membership Provider by Dinah</title>
		<link>http://codesmart.wordpress.com/2009/03/27/extending-the-microsoft-aspnet-membership-provider/#comment-79</link>
		<dc:creator>Dinah</dc:creator>
		<pubDate>Fri, 22 May 2009 18:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=80#comment-79</guid>
		<description>Thanks for the starter code. It was easy to follow but could be made far less complex. If you simply make your class a partial on the linq table object, you can cut out much of your code and complexity. In fact, everything almost takes care of itself after that, including db updates.</description>
		<content:encoded><![CDATA[<p>Thanks for the starter code. It was easy to follow but could be made far less complex. If you simply make your class a partial on the linq table object, you can cut out much of your code and complexity. In fact, everything almost takes care of itself after that, including db updates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending the Microsoft ASP.NET Membership Provider by Patrick</title>
		<link>http://codesmart.wordpress.com/2009/03/27/extending-the-microsoft-aspnet-membership-provider/#comment-78</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 13 May 2009 01:13:23 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=80#comment-78</guid>
		<description>Is it possible to extend these clases to have a hierarchy? ie a user can have a role  and that role can manager other roles?</description>
		<content:encoded><![CDATA[<p>Is it possible to extend these clases to have a hierarchy? ie a user can have a role  and that role can manager other roles?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Giving back to the community&#8230; by daggmano</title>
		<link>http://codesmart.wordpress.com/2008/09/17/giving-back-to-the-community/#comment-72</link>
		<dc:creator>daggmano</dc:creator>
		<pubDate>Wed, 18 Feb 2009 04:30:37 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=46#comment-72</guid>
		<description>Heh heh... Ah yes, but but why re-invent the re-invented wheel?</description>
		<content:encoded><![CDATA[<p>Heh heh&#8230; Ah yes, but but why re-invent the re-invented wheel?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Giving back to the community&#8230; by Steven</title>
		<link>http://codesmart.wordpress.com/2008/09/17/giving-back-to-the-community/#comment-71</link>
		<dc:creator>Steven</dc:creator>
		<pubDate>Wed, 18 Feb 2009 03:39:05 +0000</pubDate>
		<guid isPermaLink="false">http://codesmart.wordpress.com/?p=46#comment-71</guid>
		<description>I object! I can code my own slideshow thankyou :)</description>
		<content:encoded><![CDATA[<p>I object! I can code my own slideshow thankyou <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
