<?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>Transcending Frontiers &#187; Evolutionary Design Pattern</title>
	<atom:link href="http://blog.thefrontiergroup.com.au/tag/tdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thefrontiergroup.com.au</link>
	<description>Your peek inside the collective mind of The Frontier Group</description>
	<lastBuildDate>Tue, 03 Jan 2012 06:53:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Evolutionary Design Pattern</title>
		<link>http://blog.thefrontiergroup.com.au/2009/08/evolutionary-design-pattern/</link>
		<comments>http://blog.thefrontiergroup.com.au/2009/08/evolutionary-design-pattern/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 00:29:02 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Corey Haines]]></category>
		<category><![CDATA[JB Rainsberger]]></category>
		<category><![CDATA[Patterns]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=395</guid>
		<description><![CDATA[I just finished watching this informal talk by J.B. Rainsberger with Corey Haines on an evolutionary design pattern that Rainsberger uses. He says that it&#8217;s about removing duplication and bad names, to me it&#8217;s a simple way to go about enforcing modular design and implementing your design in a way that very strongly matches the [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished watching this <a href="http://programmingtour.blogspot.com/2009/08/testing-techniques-with-jb-rainsberger.html">informal talk</a> by <a title="J.B. Rainsberger" href="http://jbrains.ca">J.B. Rainsberger</a> with <a href="http://programmingtour.blogspot.com/">Corey Haines</a> on an evolutionary design pattern that Rainsberger uses. He says that it&#8217;s about removing duplication and bad names, to me it&#8217;s a simple way to go about enforcing modular design and implementing your design in a way that very strongly matches the MVC pattern.</p>
<p>The talk is about 10 minutes long but worth a listen. He gives a basic example that has common analogues in most areas of application programming.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2009/08/evolutionary-design-pattern/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2009/08/evolutionary-design-pattern/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Making a Copy of an Object in PHP</title>
		<link>http://blog.thefrontiergroup.com.au/2009/02/making-a-copy-of-an-object-in-php/</link>
		<comments>http://blog.thefrontiergroup.com.au/2009/02/making-a-copy-of-an-object-in-php/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 02:46:35 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=326</guid>
		<description><![CDATA[In PHP4 objects were passed by value, it&#8217;s probably the intuitive way to deal with variables for a beginner and in a language where objects are not first class. However in PHP5 this has been changed and now objects are passed by reference, this stung me when writing some tests recently. public function testNameIsUnique() { [...]]]></description>
			<content:encoded><![CDATA[<p>In PHP4 objects were passed by value, it&#8217;s probably the intuitive way to deal with variables for a beginner and in a language where objects are not first class. However in PHP5 this has been changed and now objects are passed by reference, this stung me when writing some tests recently. </p>
<pre class="php">
public function testNameIsUnique() {
	$test1 = $this->BuildValidDiscountType();
	$test2 = $test1;

	$test1->Save();
	$this->assertTrue($test1->id > 0);

	$this->setExpectedException('DiscountTypeException');
	$test2->Save();
}
</pre>
<p>This code shouldn&#8217;t have worked as far as I was concerned, in fact I was expecting an exception to be raised. Instead it was working and after a little debug tour I found that my <code>$test1 = $test2</code> line was causing <code>$test2</code> to be a reference to <code>$test1</code>, not what I wanted. This caused my update method to be triggered instead and of course the name is still unique. </p>
<p>It only required a small change to that line, using the <a href="http://php.net/clone">clone</a> specifier : </p>
<pre class="php">
$test1 = clone $test2;
</pre>
<p>After that everything went as expected and I knocked off another test, and added to my PHP knowledge.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2009/02/making-a-copy-of-an-object-in-php/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2009/02/making-a-copy-of-an-object-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

