<?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>phpaddiction &#187; TDD</title>
	<atom:link href="http://www.phpaddiction.com/tags/category/tdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpaddiction.com</link>
	<description></description>
	<lastBuildDate>Wed, 23 Sep 2009 19:08:34 +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>Clever Design meets TDD</title>
		<link>http://www.phpaddiction.com/tags/unit-testing/clever-design-meets-tdd/</link>
		<comments>http://www.phpaddiction.com/tags/unit-testing/clever-design-meets-tdd/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 18:00:42 +0000</pubDate>
		<dc:creator>Doug Hill</dc:creator>
				<category><![CDATA[TDD]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://www.phpaddiction.com/tags/unit-testing/clever-design-meets-tdd/</guid>
		<description><![CDATA[I've been working on my own PHP framework for a while now. I use it as a scratch pad to try out new concepts. I recently decided that I wanted to make some architectural changes that I thought were super clever (yes I know super clever is nearly always too clever), things that would save [...]]]></description>
			<content:encoded><![CDATA[<p>I've been working on my own PHP framework for a while now.  I use it as a scratch pad to try out new concepts.  I recently decided that I wanted to make some architectural changes that I thought were <em><strong>super clever</strong></em> <em>(yes I know super clever is nearly always <strong>too clever</strong></em>), things that would save me tons of tedious programming, free my mind from all the mundane details that I detest, maybe make <strong>toast</strong>.  The inspiration was so intense that I made my changes first <em><strong>then thought about testing.</strong></em></p>
<p><span id="more-20"></span></p>
<h2>When is Testability not important?</h2>
<p>The answer to that question is obvious isn't it? Testability is always important.  I spent a couple days implementing my new architecture, then about a week figuring out how to test some of the more complex features.  I was discouraged to say the least so I headed out to scour the net for some insight into where and what I had done wrong and how I could make my testing life easier. I found plenty of advice and in another day I had come up with much more testable design, in other words pretty much my framework before the changes. I had a dilemma, testing or my beautiful simple elegant design.</p>
<p>After a lot of thinking, I realized that what I was doing wasn't too clever, it wasn't bad design, it was a combination of a mental block on my part that has been pounded into my head by dozens of articles and books expounding the virtues of low coupling, a lot of naive unit testing examples for PHP and a desire to play with the cool kids who only do TDD.</p>
<p>
I went back to my original design and worked harder at the test cases with a new perspective on coupling, why was I trying to decouple classes that would never be used outside my framework, my framework is the runtime environment they will always live in, and suddenly my tests became much easier to write.  I would never have been able to accomplish this with my old perspective on testing.
</p>
<p>
Finally the reason I wrote this post, It seems like the TDD buzz is getting ever louder in the PHP world. I am not knocking TDD, but I wonder if certain viable maintainable designs could ever evolve using TDD?  Don't let the current favored methodology of the programming community stop you from thinking for yourself, there is no one true way.  <em><strong>I think I'll stick with test early and sometimes just sometimes try being too clever.</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpaddiction.com/tags/unit-testing/clever-design-meets-tdd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
